Git Branching Tutorial
git reset vs git revert
- reset : rewriting the commit history. DON’T use it on pushed branches
- revert : creat a new commit, but it reverse changes.
git cherry-pick
- you would like to copy a series of commits below your current location (HEAD).
1 | // master/HEAD is at C5 |
- useage
git describe
- Describe a commit using the most recent tag reachable from it
mixed
situation
I want to do a slight modify on newImage, then move master to C3
- starting
- goal
- sol1
re-order the commits (rebase -i)
commit –amend to make the slight modification on newImage
re-order the commits back(git rebase -i)
move master(git branch -f master
)
- sol2
git cherry-pick C2
commit –amend to make the slight modification on newImage
git cherry-pick C3