How can I determine which GIT branches are not fully merged?

So, I am interested in the opinion of the current GIT workflow (which I am new to) and how to determine which of my changes have not yet been merged / put into the corresponding repositories. So my current system looks like this:

remote.master | | V local.master | | | VVV branch branch branch 

For a new task, I will pull from remote.master to local.master, create a new branch and check it. I will make various commits while working on the task, possibly switching to other tasks, and then, when ready, pull it from remote.master to local.master, merge my branch into local.master and finally push the remote. master.

So, 2 questions: for a small team is it overkill? Does it make sense to omit local branches? If so, some advice suggests that there will be either problems with "fast redirects" (which, as I understand it, make the changes indistinguishable in remote.master), or a lot of commits that have potentially unexpected timestamps and are hard to parse.

2nd, provided that the workflow described above is: I sometimes often switch between tasks. I need a screen that shows me:

 'branch 01' -> partially merged to local.master 'branch 04' -> notmerged to local.master 'local.master' -> partially merged to remote.master 

It may be that I forget that the various functions have been combined and where. I definitely do not want to go on branches and try to solve this information through 'git diff' or other commands. I am currently using Tortoise GIT on Windows, but I am open to other graphical alternatives. I sometimes use the shell, but I prefer the interface. Is there any way to get this information?

+4
source share
1 answer

No matter what you want to do in your local environment, do not overdo it. If you want to have 100 local branches, which is completely up to you, and if that turns out to be redundant (maybe), you can scale accordingly.

"Problems with fast shipment" is a matter of taste. The default behavior of Git is to fast forward instead of merging if the two branches do not diverge. Like the author, I also donโ€™t like it, but I would not call it a โ€œproblemโ€. As a workaround, I do the following merges:

 # merge branch without fast forward and commit git merge --no-ff --no-commit branchname # code review git diff # commit the merge git commit -m 'merged: branchname' 

I use the alias rev = merge --no-ff --no-commit to simplify the merge step to git rev branchname (with the name "rev", as in the "review", as in the "code review").

To view the revlog = log --first-parent only, use a different alias: revlog = log --first-parent

Since I use a separate branch for each function, this way I can see big steps in the evolution of the project, such as a change log.

For your second question, I think you are looking for these commands:

 # view the branches that have been merged already git branch --merged # view the branches that have NOT been merged yet git branch --no-merged 

I don't know Turtle, but gitk pretty good if I remember correctly that it was included in Git Bash.

+3
source

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


All Articles