Questions tagged [reflog]

For issues relating to git reference logs, or "reflogs".

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

To manage reflog informations take use of the git-reflog command.

28 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
71
votes
4 answers

Query git reflog for all commits to a specific file

Is it possible to check the git reflog for all commits to a specific file. I made a commit to file foo.txt and now it no longer shows in the git history via git log foo.txt I want to search the reflog to find all commits to this file so I can find…
cpjolicoeur
  • 12,766
  • 7
  • 48
  • 59
20
votes
1 answer

git reflog expire and git fsck --unreachable

Disclaimer: this question is purely informational and does not represent an actual problem I'm experiencing. I'm just trying to figure out stuff for the sake of it (because I love figuring stuff out, and I know you do too). So I was playing with…
Geoffrey Bachelet
  • 4,047
  • 2
  • 21
  • 17
16
votes
9 answers

unstaged files gone after git reset --hard

I tried the git reset --hard HEAD@{n} from git reflog and I lost everything with my current unstaged files :'( the unstaged files is the last git add I did, before then I tried git reset to the last git commit. And all my files gone, I can't go back…
mochadwi
  • 1,190
  • 9
  • 32
  • 87
12
votes
2 answers

restore - git reset --hard HEAD^

Unfortunately I did several times git reset --hard HEAD^ losing a quite big chunk of code in several files. Is there a way to restore those commits or in this case to forward where the HEAD was before, so I can bring up those lines that I lost?
Lan
  • 123
  • 4
6
votes
1 answer

How to create reflogs information in an existing bare repository

As you might have known that by default, git doesn't enable reflog updates for new bare repositories. The problem is, I have a long history repository but it was created before I set the flag "logAllRefUpdates" on, and now I want that information…
instcode
  • 1,495
  • 14
  • 16
5
votes
1 answer

How can I display dates when local updates were made to a git repo?

For example: How can I display when HEAD@{2} was created? Given a commit's SHA1, how can I display the date it was pulled into the current repo, rather than (or in addition to) its commit date? I thought there would be a git reflog option for…
wchlm
  • 365
  • 1
  • 11
5
votes
1 answer

git reflog not showing branch change

In another question, a user posted the following reflog: 8c48bab HEAD@{16}: checkout: moving from develop to 8c48babb10ec2f8f28f364ce57b5095cb080c133^0 54d8daf HEAD@{17}: commit: changed the how function, it seems I was right, wc counts all lines…
wadesworld
  • 13,535
  • 14
  • 60
  • 93
5
votes
3 answers

How to turn a set of amended commits (stored in reflog) into real commits

I was doing a refactoring, and just kept amending every time I made any decent progress. It has gone very well, and I realized it would be nice to be able to show people how I handled such a huge refactoring (lots of tiny steps, just nudging code…
Joshua Cheek
  • 30,436
  • 16
  • 74
  • 83
4
votes
2 answers

Viewing expired reflog logs

Is there any way to view expired reflogs? I've been keeping a few local commit I made months ago on a local branch and I've kept it up to date with our remote branch by rebasing frequently. Somehow I've lost all of my local commits for this branch…
mpellegr
  • 3,072
  • 3
  • 22
  • 36
4
votes
1 answer

What should "git reflog show " show?

I have two branches, master and b1. When I'm on b1, 'git reflog show' displays all the changes to b1. However, after I switch to master and run 'git reflog show b1', it displays something different. The manpage for 'git reflog' does not explain how…
Ltf4an
  • 787
  • 5
  • 18
3
votes
3 answers

git - fatal: your current branch appears to be broken (possibly from interrupted pull)

Problem: accidentally did a git --amend and pushed it to a usb key from first computer pulled from the usb key to a second computer second computer repository is now corrupted git pull to first computer results in a merge conflict; confused about…
ninjagecko
  • 88,546
  • 24
  • 137
  • 145
3
votes
2 answers

why doesn't my git reflog go back up to clone

I have a question about git reflog: at the beginning of my project, when I did a git reflog, I was able to see all the steps up to my original git clone command. Today, git reflog no longer goes back up to the git clone command. More precisely, git…
Julien REINAULD
  • 599
  • 2
  • 5
  • 18
2
votes
1 answer

Why git commit can be lost in this case?

My colleague did a series of careless pull/push operations. He end up in a situation where his local commit becomes missing I recovered his commit using git reflog. But I couldn't figure out why his operations lead to the situation. Can someone shed…
Boyang
  • 2,520
  • 5
  • 31
  • 49
2
votes
2 answers

What is the most robust way to get the name of the reference last pointed to by HEAD?

After an operation that moves HEAD (such as checkout, reset, etc.), you can always get the commit ID that HEAD pointed to before that operation by running, for instance, git rev-parse @{1} What I'm interested in, though, is getting the name of the…
jub0bs
  • 60,866
  • 25
  • 183
  • 186
1
2