$ git checkout -b <nome_do_novo_branch> <SHA1_ID_OF_DESIRED_COMMIT> That will create a new branch that will be the current one. You can commit on that branch, everytime you want. But you are on a new tree, that does not make part of the “default” tree (master). The commit’s SHA1_ID must not be fully typed (I’ve seen cases on the docs where just 4 chars were enough). IMPORTANT: if you make changes on that branch and do not commit them, when you change branch those modifications will not be brought to the destination branch.
$ git checkout master
$ git checkout <branch_name> There you can make the desired changes, commit and go back to master or another branch.
Is the act of incorporating all commits from a branch into another one. E.g.: Merge the “TEMP” branch into the “MASTER” branch. Generally a commit has just one “parent commit” (which is the commit prior to itself). The merge operation results on a commit with at least 2 “parents” (also a commit can have multiple “parents”). During the merge process, the current branch becomes the “first parent” - almost always you’re not interested on the changes you made to the current branch (first parent), but indeed you are on the commits from other branches (the other “parents”) that can conflict with the current branch. NOTE: the “git pull” command automatically resolves merges, when possible. The “git pull” command gets the remote repository commits and “merges” them into your current branch. If you have not made any changes on your current branch, the merge is called a “FAST FORWARD” (analogue to getting the last version on a centralized Version Control System). But if you made changes on your current branch, git will automatically try a merge, and will report any conflicts found.
$ git checkout master
commit) $ git merge fixes That will bring into “MASTER” all commits made to the “FIXES” branch. Git will put those changes on the staging are (will do a “git add”), but will not commit the changes. So, you must do a git status to see what will change. After you verify and are OK with the changes, just do a “git commit” to make the merge effective.
Suppose the following situation: $ git merge master Auto-merged layouts/default.html CONFLICT (content): Merge conflict in layouts/default.html Auto-merged index.html CONFLICT (content): Merge conflict in index.html Automatic merge failed; fix conflicts and then commit the result. I can follow the steps below to fix those problems:
$ git branch <new_branch>
$ git checkout -b <new_branch>
$ git checkout <branch_name>
$ git branch -d <branch_name>
E.g.: Renames “master” to “part2”: $ git branch -m master part2
$ git checkout HEAD~7 -b master
$ git branch