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

Can I add a line to the reflog?

I am in the middle of rebase hell due to a botched git commit --fixup. I think I've identified the source and I'm in a better place than I started. However, if I look at the git reflog, this sequence of 'rebase -i' lines looks just like my previous…
badp
  • 11,409
  • 3
  • 61
  • 89
3
votes
4 answers

can you back up git reflog? Advice on best practice to guard against code loss

git reflog shows all activity, even squashed commits, etc. (correct me if I am wrong). Is there a git CLI command to backup git reflog? Obviously if I delete the local version of a repo I have lost my reflog (correct me if I am wrong). I wondered if…
danday74
  • 52,471
  • 49
  • 232
  • 283
3
votes
1 answer

How to recover files added to git but overwritten by checkout

Need some help! I added a few files using "git add " I wanted to checkout the other files and accidentally ran "git checkout -f" I do know its possible to get these changes back using reflog etc, but I don't know how! I know it's possible to get a…
sr09
  • 720
  • 5
  • 26
3
votes
2 answers

git checkout PREV

Is there a simple way to switch back to the branch you were most recently on prior to the current one? The same concept as "cd -" from the command line. When working on multiple branches, this can be useful.
Sridhar Sarnobat
  • 25,183
  • 12
  • 93
  • 106
3
votes
1 answer

Restore changes that were overwritten by git pull

I'm having an issue with git where I can't retrieve changes that were overridden by git pull. I had started work on a project without a GitHub repository, which I then later made. I forked the repository when it was made, which included a README…
nasonfish
  • 455
  • 1
  • 4
  • 14
3
votes
1 answer

How do you increase the number of entries output by git reflog?

I have a branch that I deleted (with -D) but I need it back. I thought the git reflog command would be a good place to look. When I run it I only see 50 actions displayed, and I can't find any commits from this branch. The branch was deleted a day…
Kryptic
  • 1,922
  • 2
  • 21
  • 29
2
votes
2 answers

git reflog - branch level summary

git reflog shows how HEAD moved between commits. Is there a way to show only branches? (i.e. show only one line per branch visit)
IndustryUser1942
  • 1,052
  • 1
  • 8
  • 12
2
votes
1 answer

How can I tweak this git log command / bash script to include deleted commits from deleted branches that git reflog should still know about?

So I have this little bash script to output a csv file that shows all my commit history from a specific month. function make-git-report() { if [ "$1" != "" ] then local month=$1 else local month=$(date +%m) fi local year=$(date…
Evert
  • 2,022
  • 1
  • 20
  • 29
2
votes
1 answer

When does git reflog command show HEAD->master and when not

I am learning git, and used the git reflog command. I have a doubt. When I run it, for some entries I see the HEAD->master written after the commit hash. But it is not written in front of all the commits. My question is, is this of any…
user185887
  • 643
  • 6
  • 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
1 answer

How to properly use `git reflog --since=...`?

I have a repository for which a regular git reflog --date=iso shows a lot of entries, for example see this fragment https://gist.github.com/FreddieChopin/0206c9ef530a056c624b065eed048c9d As you may notice, there are reflogs for 19th, 22nd, 23rd,…
Freddie Chopin
  • 8,440
  • 2
  • 28
  • 58
2
votes
1 answer

Item with empty message in git reflog

I've just noticed item in my reflog with empty message. Do you have any idea what could create empty item in log, please? fadea5a HEAD@{6}: merge stable/abc: Merge made by the 'recursive' strategy. b03c8c7 HEAD@{7}: merge stable/xyz: Merge made by…
Northys
  • 1,305
  • 3
  • 16
  • 32
2
votes
1 answer

Best way to export a git repo and include reflog

I want to save and share a git repo with everything in it, including the current reflog state. Is the best way to do this just to zip up the .git directory? Or could there be a better way?
willoller
  • 7,106
  • 1
  • 35
  • 63
2
votes
1 answer

Git: How to revert a force push

Is it possible to revert my master branch to its initial state if I did a force push on the server with a code that was not up to date? I tried reflog command but it is not working as it keeps track to the local commits only.
Laura
  • 2,653
  • 7
  • 37
  • 59