# Find changes since last commit

### Why

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>`.

### Try it

First, make sure you [set Beyond Compare](http://www.scootersoftware.com/support.php?zz=kb_vcs) as Git's tool.

Skip Steps 1, 2, & 3 if you are using your own code.

1. Make a new folder, start a repository there, and open an editor `mkdir te && cd te && git init && nano streets.txt`
2. Save the file in your editor.  Then commit that. `git commit -m "First commit."`
3. 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.&#x20;
4. Briefly glance at the terminal way to see your saved code vs. your committed code:  `git diff streets.txt`
5. Now see the same thing in Beyond Compare! Way better:`git difftool streets.txt`
6. Finish by writing your commit message:  `git -m "Capitalize all.  Specify South and Hills.  Add four streets."`

![](https://1446155253-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LXUX-uoaZJ8T4qyEc-x%2F-Lc1alvr0w3eeFV757iS%2F-Lc1aO_iWJiMzm77W1G1%2FScreen%20Shot%202019-04-09%20at%209.55.11%20AM.png?alt=media\&token=afd86b69-8ca6-44e7-a30c-1b6266af4f8c)

### Review

What we just diffed was the **Working Tree** vs the **Commited Repository**

![Image by Freek Dijkstra](https://1446155253-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LXUX-uoaZJ8T4qyEc-x%2F-Lc1iKLP53zYnhjTnCrK%2F-Lc1iesiZAPItcy0LGts%2FGitBuckets.png?alt=media\&token=7c915f9d-11ac-4269-b556-711ebd3fecce)

### Productivity hack

Another way to use difftool is to always _start_ the day with it.&#x20;

The Changelog's [Adam Stacoviak](https://changelog.com/)  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.&#x20;
