reflog

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

筅森魡賤 提交于 2019-12-17 21:38:02
问题 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 when each reflog entry was added? The manpage isn't forthcoming... 回答1: As the man page writes you can use the options for git log , say git reflog --pretty=short or any other as you like try git reflog --date=iso 回答2: You can use the --walk-reflogs

How to create reflogs information in an existing bare repository

对着背影说爱祢 提交于 2019-12-07 02:48:27
问题 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 for another application to work. How can I achieve that with minimal changes made to the existing repository. A very simple solution is pushing a new commit which I don't want to (!) :-) 回答1: The reflog is a relatively simple file format. Here's an

restore - git reset --hard HEAD^

怎甘沉沦 提交于 2019-12-04 17:20:58
问题 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? 回答1: Use the reflog to recover the sha1 of the previous HEAD. In particular, the article reflog, your safety net will be particularly relevant to you. From that article: The most common usage of this command is that you’ve just done a git reset and

restore - git reset --hard HEAD^

断了今生、忘了曾经 提交于 2019-12-03 11:05:32
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? Use the reflog to recover the sha1 of the previous HEAD. In particular, the article reflog, your safety net will be particularly relevant to you. From that article: The most common usage of this command is that you’ve just done a git reset and moved your HEAD back a few commits. But oops, you need that bit of code you left in the second commit. Crap.

git reflog expire and git fsck --unreachable

a 夏天 提交于 2019-11-28 23:15:53
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 git, trying to expire an amended commit. My reflog looks like that: 4eea1cd HEAD@{0}: commit (amend): amend commit ff576c1 HEAD@{1}: commit: test: bar 5a1e68a HEAD@{2}: commit: test: foo da8534a HEAD@{3}: commit (initial): initial commit Which means I made two commits ( da8534a and 5a1e68a ), then a third commit ff576c1 that I amended with 4eea1cd .

Query git reflog for all commits to a specific file

这一生的挚爱 提交于 2019-11-28 17:25:35
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 my "lost" commit. ralphtheninja Try: git rev-list --all -- foo.txt This will give you a list of all commits containing foo.txt. Came across this while searching for an answer, which is simple: git reflog -- $PATH , which will include amends and other actions that will not be visible otherwise (though beware, reflog will be pruned by gc) wdev I'd use:

unstaged files gone after git reset --hard

旧时模样 提交于 2019-11-28 11:11:36
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 to the git add before last commit :'( Andrew C It's not clear if you lost files in your working directory, or files in the index. You say you lost your "unstaged files", but then you mention you might have run "git add". "unstaged files" are lost for good. Staged files can be recovered with git fsck --full --unreachable --no-reflog For each file

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

偶尔善良 提交于 2019-11-28 02:40:40
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 when each reflog entry was added? The manpage isn't forthcoming... As the man page writes you can use the options for git log , say git reflog --pretty=short or any other as you like try git reflog --date=iso You can use the --walk-reflogs variant of git log : git log -g This is rather verbose by default, and prints the date among other things. You

git reflog expire and git fsck --unreachable

夙愿已清 提交于 2019-11-27 14:38:33
问题 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 git, trying to expire an amended commit. My reflog looks like that: 4eea1cd HEAD@{0}: commit (amend): amend commit ff576c1 HEAD@{1}: commit: test: bar 5a1e68a HEAD@{2}: commit: test: foo da8534a HEAD@{3}: commit (initial): initial commit Which means I

Query git reflog for all commits to a specific file

最后都变了- 提交于 2019-11-27 10:15:48
问题 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 my "lost" commit. 回答1: Try: git rev-list --all -- foo.txt This will give you a list of all commits containing foo.txt. 回答2: Came across this while searching for an answer, which is simple: git reflog -- $PATH , which will include amends and other