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
7
votes
2 answers

Git: Deleted current branch and lost reflog

I ran into an unusual git issue earlier that I've since resolved, but I'm still curious as to why it happened. The problem occurred when I accidentally deleted the branch I was currently working on. Normally git wouldn't allow this, but due to…
user2221343
  • 614
  • 5
  • 16
6
votes
2 answers

Is there a reflog for the index?

I do not have a specific problem at hand, but I have encountered in the past some cases where I accidentally blew up my index, and wished I could go back the the previous state of a given file, which was indexed at some point. Some example cases are…
LeGEC
  • 46,477
  • 5
  • 57
  • 104
6
votes
1 answer

Push to origin after reflog expire and gc prune

I removed some unreachable and dangling commits in my local repo using git fsck --unreachable --dangling --no-reflogs git reflog expire --expire=now --all git gc --prune=now But I find the removed commits still available on the origin (GitHub, to…
ADTC
  • 8,999
  • 5
  • 68
  • 93
5
votes
1 answer

What is the 2nd column in the git reflog?

I just did a simple git reflog and this is the first few lines I got: column1 Column2 Column3 2797a1d4 (HEAD -> master, upstream/master) HEAD@{0}: checkout: moving from master to master 2797a1d4 (HEAD…
mfaani
  • 33,269
  • 19
  • 164
  • 293
5
votes
1 answer

List squashed commits

After I do the interactive rebase: git rebase -i HEAD~20 I get a new commit, e.g. ea1234ea I know that the history is in the reflog, but how can I get a list of commits squashed in this commit including their identifiers (sha)? git show ea1234ea…
takeshin
  • 49,108
  • 32
  • 120
  • 164
4
votes
2 answers

Git list out stashes specifically from one branch

I have 2 branches: Section9 and s9feature. On the branch s9feature I made stash, then I checkout on Section9 branch and want to see the list of stashes specifically from s9feature. I know that I can run git stash list or git reflog stash but I need…
Katerina
  • 43
  • 4
4
votes
1 answer

Determine what prevents a commit from being pruned from git

How can I determine what is preventing a commit from being pruned from git by the following commands? git reflog expire --expire=now --all git gc --prune=now Details I want to completely remove a commit (with, e.g., commit hash XYZ) from my clone.…
XDR
  • 4,070
  • 3
  • 30
  • 54
4
votes
1 answer

keep reflog for deleted references

On my local clone of a git repo, when a reference is deleted (or renamed), the reflog attached to the old name is deleted. I couldn't find an option which states "keep log for deleted references". Question Is there a way to keep the reflog files for…
LeGEC
  • 46,477
  • 5
  • 57
  • 104
4
votes
1 answer

how to redo discarded local changes in git?

Let have a file a tracked by git and modified locally. Moreover, that file was in the stash too. Then: If you did it git stash pop, see this link If accidentally you did only this git checkout a you've lost. That discards all changes in a file. How…
Sławomir Lenart
  • 7,543
  • 4
  • 45
  • 61
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

Strange Git behavior when checking out HEAD (and variants) on Windows

Setup Let's imagine a simple repository as follows. One can see that HEAD points at master $ git log --decorate --graph * commit 99d20608088ba9c74b57e36a1b0b79ff2be42d68 (HEAD, master) | Author: Saaman | Date: Wed Apr 17…
Saaman
  • 598
  • 4
  • 14
4
votes
2 answers

Screwed up the master git branch... Can't figure out what I need to revert

I'm working on a git repository that has a branch off of master, we'll call it the ab branch. My team is working on the ab branch and has a pull-request workflow using github. One of my teammates made a pull request from his branch…
nzifnab
  • 15,876
  • 3
  • 50
  • 65
3
votes
1 answer

How to get the full git reflog output when the output is pushed into a pipe

How can I get the output of git reflog into some other programs, without to copy+paste it. When I pipe the output, the branch names suddenly disappear: $ git --no-pager reflog 8c394ee (HEAD -> master) HEAD@{0}: commit: Bar cbf7358 HEAD@{1}: commit…
Rudi
  • 19,366
  • 3
  • 55
  • 77
3
votes
2 answers

Git repository broken by interrupted commit

I broke my local git repository by interrupting a git commit with Ctrl+C (two commits back). How can I fix it ? Output of git stash : $ git stash fatal: bad revision 'HEAD' fatal: bad revision 'HEAD' fatal: Needed a single revision You do not have…
SecT0uch
  • 71
  • 7
3
votes
1 answer

git reflog in bare repository with core.logAllRefUpdates set true returns nothing

I have mirrored a git repository using git clone --mirror, then set git config core.logAllRefUpdates true, then later updated with git fetch -p. On the server hosting the repo, if I run git reflog in the repository.git directory, I get no…
retrodev
  • 2,323
  • 6
  • 24
  • 48