Git
Useful Commands
Create a new branch from a tag
git checkout -b newbranch v1.0
Merge commits interactively with rebase
Be aware that this modifies the history, don’t do that in a branch where others could be working, for example master.
git rebase -i <hash until want to unify -> parent commit>
Merge commits undoing commits
git reset —soft HEAD~<number of commits>
git stash
git reset —hard origin/master
git stash pop
Dealing with weird conflicts when rebasing from master
In case you have a PR with one single commit and you need to update from master:
git reset —soft HEAD~1
git stash
git reset —hard origin/master
git stash pop
Add changes to the last commit
Be aware that this modifies the history, don’t do that in a branch where others could be working, for example master.
git commit —amend
Undo last commit but keeping changes pending to commit
git reset —soft HEAD~
Remove tag
git tag -d v0.5.0 && git push origin :refs/tags/v0.5.0
Tools
- To generate cool graphics of all repo history: https://gource.io/
Resources
- Understanding the GitHub flow: https://guides.github.com/introduction/flow/