Questions tagged [git-reflog]

For issues relating to the git-reflog command to manage information recorded in reflogs.

git-reflog is a command to manage the information recorded in the reflogs.

Reference logs, or "reflogs", record when the tips of branches and other references were updated in the local repository.

Syntax:

git reflog <subcommand> <options>
89 questions
449
votes
8 answers

Is there a way to cause git-reflog to show a date alongside each entry?

The git-reflog command doesn't by default show a date alongside each entry, which strikes me as a strange oversight; I think this would be very helpful. Are there any command-line options, or other tweaks, which can be employed to cause it to show…
Andrew Ferrier
  • 16,664
  • 13
  • 47
  • 76
308
votes
8 answers

How can I move HEAD back to a previous location? (Detached head) & Undo commits

In Git, I was trying to do a squash commit by merging in another branch and then resetting HEAD to the previous place via: git reset origin/master But I need to step out of this. How can I move HEAD back to the previous location? I have the SHA-1…
timpone
  • 19,235
  • 36
  • 121
  • 211
287
votes
13 answers

How do I remove the old history from a git repository?

I'm afraid I couldn't find anything quite like this particular scenario. I have a git repository with a lot of history: 500+ branches, 500+ tags, going back to mid-2007. It contains ~19,500 commits. We'd like to remove all of the history before Jan…
ebneter
  • 20,795
  • 9
  • 30
  • 30
230
votes
7 answers

What's the difference between git reflog and log?

The man page says that log shows the commit logs and reflog manages reflog information. What exactly is reflog information and what does it have that the log doesn't? The log seems far more detailed.
Noich
  • 14,631
  • 15
  • 62
  • 90
88
votes
4 answers

Can I view the reflog of a remote (not remote ref)?

Is it possible to view the reflog of a remote? That is, I want to know what the output of git reflog is on another remote machine. Note that I am not asking for the reflog of remote-tracking branches (such as origin/master); I am asking for what…
Alexander Bird
  • 38,679
  • 42
  • 124
  • 159
38
votes
3 answers

Git reflog a specific branch?

Can I reflog a specific branch? git reflog shows all history on the repo. But I want to check the history of one specific branch, say production. Is there a way to do that?
Asim K T
  • 16,864
  • 10
  • 77
  • 99
19
votes
3 answers

How to see where a branch was rebased and what branch it was rebased from?

I know that GIT rebases will rewrite the history -- i.e. the commit ids will change. However, Is there any way to trace when a branch was rebased and from which branch? EDIT: I have a development branch 'A' and a topic branch 'B'. 'A' is shared by…
mustard
  • 715
  • 1
  • 5
  • 18
18
votes
2 answers

Is there a way to output the previous git branch name?

This answer tells how to checkout to the previous branch, and helpfully explains @{-1}: https://stackoverflow.com/a/7207542/3150057 The previous branch is important if I stashed some code before changing branch, and am now thinking about working on…
Henry Blyth
  • 1,700
  • 1
  • 15
  • 23
16
votes
1 answer

GIT - Remove old reflog entries

After a lot of rebasing a repository to our latest needs our reflog is full of commits and orphan branches. We reached the final state of our reorganization. While there're branches and commits left with a lot of binary data the repository grew…
codekandis
  • 712
  • 1
  • 11
  • 22
14
votes
1 answer

Keep Git Reflog Indefinitely?

I tend to be a bit paranoid about my data, including the ability to recover it. Git reflog data is pruned after 30 days. Is there a way of setting it so that the reflog data is maintained and kept indefinitely? Any major advantage or disadvantage…
haziz
  • 12,994
  • 16
  • 54
  • 75
13
votes
2 answers

Recover files that were added to the index but then removed by a git reset

I added some files to the index but then by mistake I deleted them with git reset --hard. How do I recover them? Here's what happened: I added all files using git add . I then committed When I checked the status, there were still files that…
Jeff Eisley
  • 193
  • 1
  • 2
  • 10
11
votes
1 answer

Where does git store its reflog?

I know that compressed version of reflog is stored in .git/packed-refs but where is actual reflog is located and how git restores history when one types git reflog ?
TOP KEK
  • 2,593
  • 5
  • 36
  • 62
8
votes
3 answers

Git get history of branches that i was in

I need to see the history of branches that i was using. For example i have 4 branches: master, b-1, b-2, b-1-1. Thе branch "b-1-1" is child of branch "b-1". First i was at master branch, then at branch b-1, then at branch b-1-1 , then at branch b-2,…
john2994
  • 393
  • 1
  • 3
  • 15
8
votes
3 answers

How to git push the reflog?

Is there a way to push the reflog to a remote? This seems like it would be an incredibly useful thing to do, but I do not know of a way to do it. I'm envisioning something like git push --include-reflogs In the end, I would want the remote to have a…
Alexander Bird
  • 38,679
  • 42
  • 124
  • 159
7
votes
1 answer

What benefit is there to use --grep-reflog?

I noticed in the documentation you can specify the parameter --grep-reflog --grep-reflog= Limit the commits output to ones with reflog entries that match the specified pattern (regular expression). With more than one --grep-reflog,…
aug
  • 11,138
  • 9
  • 72
  • 93
1
2 3 4 5 6