Push a specific commit (actually: everything up and including this commit):
git push origin dc97ad23ab79a2538d1370733aec984fc0dd83e1:masterPush everything exept the last commit:
git push origin HEAD~:masterThe same, now the last two commits:
git push origin HEAD~2:masterReorder commits, aka rebasing:
git rebase -i originPulling commits from repo to local
git pull --rebaseWhen a conflict occurs, solve it, then continue:
git rebase --continuePut local changes apart (shash them)
git stash save stashnameShow all stashes
git stash listRetrieve a shash
git stash stashnameWhen you have committed a change and want to revert it:
Make sure all work is committed or stashed!
git checkout 748796f8f2919de87f4b60b7abd7923adda4f835^ file.pp
git commit
git revert HEAD
git rebase -i
git commit --amendExplanation:
– Checkout the file as it was before your change (line 1)
– commit it (line 2)
– Revert this commit (line 3)
– Using rebase merge (fixup) this commit with the previous commit that contained a change that you want to remove (line 4)
– Finally, rewrite the commit message and you’re done (line 5)
Git rocks!

Comments
No comments were left on this post. New comments are closed.