git-reflog

Scope of gc prune and git reflog expire, and related config

安稳与你 提交于 2019-12-06 05:46:24
We are using throwaway integration branches which are pushed, and then later deleted and recreated. However the discarded branches are leaving dangling commits and trees which I can view with this command: git fsck --unreachable --no-reflogs I could clean them up with git reflog expire --expire-unreachable=now --all git gc --prune=now or something similar, but I want to understand the scope of these commands and related configuration first. So the specific questions: So that new clones are lean, how can I gc prune and clear the reflogs, not just locally but also on our remote repository hosted

What benefit is there to use --grep-reflog?

半世苍凉 提交于 2019-12-05 13:52:53
I noticed in the documentation you can specify the parameter --grep-reflog --grep-reflog=<pattern> Limit the commits output to ones with reflog entries that match the specified pattern (regular expression). With more than one --grep-reflog, commits whose reflog message matches any of the given patterns are chosen. It is an error to use this option unless --walk-reflogs is in use. I kind of wanted clarification on how this is different from --grep . What benefit is there for looking through actions made through the git reflog s? Is it just so you know what is available in git reflog so if you

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

一曲冷凌霜 提交于 2019-12-04 18:03:47
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, 24th, 25th and 26th of February. But if I would like to limit the output to certain dates, this doesn't work as expected. For example git reflog --date=iso --since="2017-02-20" gives only this https://gist.github.com/FreddieChopin/fb7619dee8fde055a1cce6f6ff2f6eb6 - it stops at "52896f49 HEAD@{2017-02-24 20:53:29 +0100}", even though there are reflogs

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

What's the difference between git reflog and log?

淺唱寂寞╮ 提交于 2019-11-27 10:04:23
The man page says that log shows the commit logs and reflog manages reflog information. What exactly is reflog information and what does it have that the log doesn't? The log seems far more detailed. ben_h git log shows the current HEAD and its ancestry. That is, it prints the commit HEAD points to, then its parent, its parent, and so on. It traverses back through the repo's ancestry, by recursively looking up each commit's parent. (In practice, some commits have more than one parent. To see a more representative log, use a command like git log --oneline --graph --decorate .) git reflog doesn

Recover files that were added to the index but then removed by a git reset

北慕城南 提交于 2019-11-26 15:27:56
I added some files to the index but then by mistake I deleted them with git reset --hard . How do I recover them? Here's what happened: I added all files using git add . I then committed When I checked the status, there were still files that weren't included in the commit from the add, which was strange I added the untracked files again and it worked this time But I wanted everything to be in 1 single commit so I looked up how to unstage what I just committed I used git reset --hard HEAD^ — bad idea obviously, all files were deleted so then I used git reflog to find where I left off then I

What&#39;s the difference between git reflog and log?

痴心易碎 提交于 2019-11-26 14:59:53
问题 The man page says that log shows the commit logs and reflog manages reflog information. What exactly is reflog information and what does it have that the log doesn't? The log seems far more detailed. 回答1: git log shows the current HEAD and its ancestry. That is, it prints the commit HEAD points to, then its parent, its parent, and so on. It traverses back through the repo's ancestry, by recursively looking up each commit's parent. (In practice, some commits have more than one parent. To see a

How to move HEAD back to a previous location? (Detached head) & Undo commits

荒凉一梦 提交于 2019-11-25 22:13:45
问题 In git, I was trying to do a squash commit by merging in another branch and then resetting HEAD to the previous place via: git reset origin/master But I need to step out of this. How can I move HEAD back to the previous location? I have the SHA1 frag ( 23b6772 ) of the commit that I need to move it to. How can I get back to this commit? 回答1: Before answering let's add some background, explaining what is this HEAD . First of all what is HEAD? HEAD is simply a reference to the current commit