git version 1.7.4.4
I am working on a new project from my development team.
So I have just cloned the project. The project has 5 branches.
I need to know what branch was the latest changes made to. So I can start working on that branch, as that would have the latest changes.
I have looked at the log. However, but that doesn't tell me that branches those commits where made to.
Many thanks for any 开发者_StackOverflow中文版suggestions,
A git log --decorate
would add tags and branches to each line.
--decorate[=short|full|no]
Print out the ref names of any commits that are shown.
Ifshort
is specified, the ref name prefixesrefs/heads/
,refs/tags/
andrefs/remotes/
will not be printed.
Iffull
is specified, the full ref name (including prefix) will be printed.
The default option isshort
.
You can use git for-each-ref
to get a list of branches ordered by the date of the last commit on those branches, for instance:
git fetch origin # Update all your remote tracking branches from origin
git for-each-ref --sort=committerdate refs/remotes/origin/
The branches listed at the end have the most recent commits at their tip. (For a script that produces the relevant dates as well as the branch name you could look here.)
精彩评论