Find changes since last commit
Last updated
Last updated
After you write a bunch of code and save it, you sometimes can't perfectly remember the details of all the things you changed. The syntax for comparing what you saved to what you committed in Git is git difftool <filename>
.
First, make sure you set Beyond Compare as Git's tool.
Skip Steps 1, 2, & 3 if you are using your own code.
Make a new folder, start a repository there, and open an editor mkdir te && cd te && git init && nano streets.txt
Save the file in your editor. Then commit that. git commit -m "First commit."
Now that you have a file and are in a repository, go into your editor and add some lines. Save the file but don't commit it.
Briefly glance at the terminal way to see your saved code vs. your committed code: git diff streets.txt
Now see the same thing in Beyond Compare! Way better:git difftool streets.txt
Finish by writing your commit message: git -m "Capitalize all. Specify South and Hills. Add four streets."
What we just diffed was the Working Tree vs the Commited Repository
Another way to use difftool is to always start the day with it.
The Changelog's Adam Stacoviak says his favorite trick is to end the day by saving files to his index but not committing them. That way in the morning he is forced to read his diff, and then write his commit. This morning ritual reintroduces him to what he was thinking at yesterday's quitting time.