World-wide techniques
In this section, you will raise your skills by learning some techniques that will come in handy in different situations.
Changing the last commit message
This trick is for people who don't double-check what they're writing. If you pressed the Enter key too early, there's a way to modify the last commit message, using the git commit
command with the --amend
option:
$ git commit --amend -m "New commit message"
Please note that with the --amend
option, you are actually redoing the commit, which will have a new hash; if you already pushed the previous commit, changing the last commit is not recommended; rather, it is deplorable and you will get in trouble.
Tracing changes in a file
Working on source code in a team, it is not uncommon ...
Get Git: Mastering Version Control now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.