Basic commands are well documented elsewhere. Here are some operations I’ve found useful in real projects.
Resources
Delete a Remote Branch
Since Git v1.7.0, the recommended syntax is:
| |
See git-push docs.
Undo the Last Commit
| |
Reference: Stack Overflow.
Note: If you only need to fix a commit message, use git commit --amend instead. It is simpler and preserves the commit history.
Cherry-Pick a Specific Commit
When working with multiple branches, it is easy to accidentally modify the wrong branch. Instead of manually reapplying changes:
| |