opike
opike

Reputation: 7575

Attempting to interpret output of 'git log --graph'

I've done a 'git --reset hard origin/master' on a local branch so I'm expecting my local branch to match exactly to the remote one. However when I do a:

git log --graph --oneline --decorate --all

I get the following output at the top:

*   dfd9bc6 (refs/stash) On z_tmp2: tmp1
|\  
| * 49f3b6f index on z_tmp2: 84e2002 localconfig
|/  
* 84e2002 localconfig
| * 1110f48 (origin/congo-3.1-stable) Boiler plate code to support

Commits 84e2002, 49f3b6f and dfd9bc6 appear to be local work which I though would've been wiped out by the 'reset --hard', but apparently I'm missing something.

Upvotes: 1

Views: 111

Answers (1)

Nevik Rehnel
Nevik Rehnel

Reputation: 51935

The reset does not wipe anything out, it only literally resets a branch to a different commit.

As you can see in your log output, you still have a ref (refs/stash, your default stash) pointing to your old commits.

If you do not need those commits any longer and want to make them disappear from the log, use

git stash drop

The actual deletion of the commits from the Git object store will happen with the next run of Git's garbage collector, once the commits are no longer referenced. But unless you have disk space issues, you probably won't have to worry about that.

Upvotes: 1

Related Questions