Git reflog of a specific branch?

Is it possible to update a specific branch?

git reflog shows the entire history of the repo. But I want to check the history of one particular branch, say production . Is there any way to do this?

+5
source share
2 answers

As noted in the documentation , git reflog accepts an action verb (called <subcommand> ) and optional modifiers. The default action is show , and its optional modifier is the name of the link to display.

The default value is to show operations on HEAD . (Most, but not all, β€œeveryday” commands work and / or through HEAD to work with any other link. Therefore, the statement that git reflog shows the whole story is actually false, but it shows a majority that may be close enough .) This gives you an immediate and obvious answer to the question about the mapping of operations applied to a particular production branch name:

 git reflog show production 

As noted in the documentation, git reflog show is an alias for git log -g --abbrev-commit --pretty=oneline , so you can also run:

 git log -g --abbrev-commit --pretty=oneline production 

to get the exact result. The key switch here is -g , which directs git log to execute the given ref reflog, and not to achieve reachability from the commit that the reflector points to.

(You can continue to leave the show verb, as it is still the default, although for this case I would advise you to enable it, for example, if your branch has the name show or expire , the name will be mistaken for the verb!)

+6
source

git reflog can take a branch as a parameter. How to git reflog production

+2
source

Source: https://habr.com/ru/post/1258693/


All Articles