Questions tagged [reflog]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
111 views

How can I use `git reflog format` while showing it as sorted by date?

I want list use git reflog format, and show it as sorted by date with (--date=relative) flag. git reflog --format='%C(auto)%h %<|(17)%gd %C(blue)%cr%C(reset) %gs' has following output: $ git ...
  • 2,735
1 vote
2 answers
322 views

remove single git reflog entry by hash/id

I committed sensitive data to a single file on my main branch. I never pushed it. I can change HEAD to point to the previous commit with git reset HEAD^, but the commit is still hanging around as git ...
  • 1,882
0 votes
1 answer
43 views

Can an admin access my reflog to revert commit changes?

I recently made a commit and it was incorrect so I tried to reset it to another commit. Now I'm realizing that the commit had information we needed for our team. Can the GitHub organization's admin ...
  • 1
1 vote
2 answers
382 views

Can `git reset --soft` be used to undo secrets from a commit before pushing to a remote (Github)?

Suppose I have a git repo with app.py and I accidentally include an API key (or other secret) as plaintext in app.py in a commit that I have not yet pushed to a remote (lets say on Github). To undo ...
  • 23
0 votes
2 answers
247 views

Solving git upstream rebase "hard case"

Wouldn't the git upstream rebase "hard case" problem be solved if each branch carried a reference to its initial base commit (say branch@{base}) ? This initial base commit (stored under ...
  • 341
3 votes
3 answers
2k views

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 ...
  • 87.4k
2 votes
1 answer
109 views

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 ...
  • 2,510
3 votes
2 answers
958 views

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 ...
4 votes
2 answers
185 views

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'...
  • 3,042
4 votes
1 answer
71 views

What should "git reflog show <ref>" 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. ...
  • 767
1 vote
1 answer
2k views

Getting full commit history after git clone

I'm the lone developer on a project where I'm working across multiple computers, some on VM. After doing a git clone of my repo on gitHub, calls to reflog only show items after the clone. How can I ...
  • 442
1 vote
2 answers
2k views

Can't recover commit from Git due to same sha in reflog

I'm trying to recover code because I accidentally switched to a branch in eclipse and lost all my data, somehow (I still don't know what I did). When I open up my git reflog in command line, I see: ...
16 votes
9 answers
19k views

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 ...
  • 1,140
2 votes
2 answers
89 views

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 ...
  • 58.7k
2 votes
3 answers
367 views

Wrap Long git reflog Lines?

git reflog displays a single-line description, clipping it at the right margin. 74a8491 HEAD@{0}: checkout: moving from feature/x to feature/y 74a8491 HEAD@{1}: commit (merge): Merge branch 'feature/...
  • 8,983
1 vote
1 answer
434 views

git rebase abort and empty reflog

I stupidly aborted a forgotten rebase with commits and uncommitted changes both on top of it, so it blew everything away, similar to questions like this. I know about the reflog and immediately went ...
5 votes
1 answer
350 views

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 ...
  • 355
430 votes
9 answers
92k views

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 ...
5 votes
1 answer
467 views

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 ...
  • 13.4k
5 votes
3 answers
188 views

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 ...
  • 29.9k
1 vote
1 answer
164 views

which commit was cherry-picked?

How can you find out which commit was used in a cherry-pick operation? git reflog only seems to show the resulting commit Sha-1 after the cherry-pick is merged and commited. We need to find the ...
  • 2,949
20 votes
1 answer
5k views

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, ...
70 votes
4 answers
23k views

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 ...
  • 12.7k
6 votes
1 answer
1k views

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 "...
  • 1,485
0 votes
3 answers
266 views

git reflog. Is this an appropriate use?

this is hypothetical at the moment, but it's a workflow I would like to put into practice. I have a template that I start all of my web projects from. I am currently using github to store the master ...
  • 28.9k
1 vote
3 answers
2k views

Getting the sha1 of a desired commit from a remote repository

Using git reflog, a user can only access his local reflog information? How can one see the sha1 of a desired commit from a remote repository?
  • 17.6k
12 votes
2 answers
2k views

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,...
  • 123