Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to `git log` a tree-ish from another branch?

Tags:

git

git-log

Let's say I have a Git repo with branch A and branch B.
Branch B is currently checked out (i.e. .git/HEAD contains refs/heads/B).
Now, without checking out branch A, how to view the history (log) of path/file in branch A?

Following git help rev-parse, I've attempted to use git log A:path/file, but that doesn't seem to work (outputs nothing). Why?

like image 825
ulidtko Avatar asked Sep 16 '13 14:09

ulidtko


People also ask

Can you pull from another branch git?

After running the stash command for a branch, if the git user wants to pull the branch's changes to another branch, it can be done easily by using the `git stash pop` command that works like the `git merge` command.

What is git tree ish?

tree-ish (also treeish) A tree object or an object that can be recursively dereferenced to a tree object.

Does git log show all branches?

Graph all git branchesDevelopers can see all branches in the graph with the –all switch. Also, in most situations, the –decorate switch will provide all the supplemental information in a formatted and nicely color-coded way.

How do I commit a git log?

On GitHub.com, you can access your project history by selecting the commit button from the code tab on your project. Locally, you can use git log . The git log command enables you to display a list of all of the commits on your current branch. By default, the git log command presents a lot of information all at once.


1 Answers

Try this (without the angle brackets):

git log <branch> -- <path/to/file>

like image 137
pattivacek Avatar answered Sep 17 '22 15:09

pattivacek