ritter
ritter

Reputation: 7699

How to check in git to which branch was the last change made?

Just cloned a git repo which has (besides the master branch) a lot of development branches. How can I tell which branch it was that the latest change was made to?

Most elegantly of course.

Upvotes: 2

Views: 80

Answers (1)

mipadi
mipadi

Reputation: 410562

You can get all commits by running git log --all. The first should be the latest commit. So you can list the branches that contain that commit with:

$ git branch --contains $(git log --oneline --all | cut -d ' ' -f 1 | head -n 1)

Upvotes: 1

Related Questions