Is it possible to see only commits in a specific branch in git?

Usually 'git log' shows all commits that contribute to the current point, even those commits that came from branches merged into the current branch.

Is it possible to issue a command to see only commits in a certain branch? That is, if there is an integration branch where everything merges immediately before sending, is there any git command to see only those commits in this branch?

+3
source share
3 answers

This (which you already know) defines a set of commits available from integration:

g log integration

"^" , (rev). , , :

g log ^master integration

(, ):

g log master..integration

(, master devel):

g log ^master ^devel integration

, , , . man git-rev-parse .

+6

:

git checkout <branch>
git diff master <commit just before the merge to master>

, , .

git log -p -m --first-parent, git help log docs; - .

+1

I'm not quite sure. The idea of ​​a branch in git is just a pointer to a location in a tree (and not a completely separate development line, for example, in svn, etc.).

However, you can swipe the git branch --no-mergedto see which branches need to be integrated into the current one.

I assume that you can write something that will give you all the commits that are only for the current HEAD and nowhere else. I am not sure how to do this.

0
source

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


All Articles