Ha Khanh Nguyen (hknguyen)
git commit), the next commit stores a pointer to the commit that came immediately before it.
masterbranch that points to the last commit you made.
masterbranch pointer moves forward automatically.
git branch testing
testingis created and points at the current commit:
git branchcommand only created a new branch, it did NOT switch to the new branch.
git checkoutwith the
git checkout -b ha_branch
git checkout testing
HEADto point to the testing branch.
git commitcommands, this is the result:
git checkout master
That command did two things:
HEADpointer back to point to the
masterbranch, and it reverted the files in your working directory back to the snapshot that
testingbranch so you can go in a different direction.
Now, let’s make a few changes and commit again!
hotfixis what you want, and finally merge the
hotfixbranch back into your
git checkout master git merge hotfix
hotfixanymore, so we can delete it!
git branch -d hotfix
git checkout master git merge iss53
This lecture notes referenced materials in 3.1, 3.2 sections of Pro Git by Scott Chacon and Ben Straub.