How can I see the git history of the remote branch (using the git thread)

I used git stream to create two branches with git flow feature start <feature name> . I don't remember if I finished

  • Using the git flow feature finish in both branches,
  • Merge branch A into branch B , remote branch A , and then run git flow feature finish from branch B or
  • Merging branch B into develop using git flow feature finish , then merging branch A into develop using git merge , resolving git merge conflicts, and then deleting branch A using git branch -d <branch name>

Using git reflog last trace of branch A , I can find e553bf0 in the series:

 e553bf0 HEAD@ {40}: checkout: moving from feature/a to develop 6b30050 HEAD@ {41}: checkout: moving from develop to feature/a e553bf0 HEAD@ {42}: checkout: moving from feature/a to develop 6b30050 HEAD@ {43}: checkout: moving from develop to feature/a e553bf0 HEAD@ {44}: commit (merge): resolved merge conflicts 7a0ad6b HEAD@ {45}: checkout: moving from feature/a to develop 6b30050 HEAD@ {46}: checkout: moving from develop to feature/a 7a0ad6b HEAD@ {47}: merge feature/b: Merge made by the 'recursive' strategy. 921ae46 HEAD@ {48}: checkout: moving from feature/b to develop 

In addition, git log shows

 commit e553bf07272ab2b1975917b736b37127636c0db1 Merge: 7a0ad6b 6b30050 Author: Eric Baldwin <address-here> Date: Thu Jul 25 14:58:49 2013 -0400 resolved merge conflicts commit 7a0ad6b2277c0c0a7599193829f68517ac708ca2 Merge: 921ae46 02558b6 Author: Eric Baldwin <address-here> Date: Thu Jul 25 14:03:56 2013 -0400 Merge branch 'feature/b' into develop 

The code from both functions is currently in develop , but I don't know for merges to happen. Can someone tell me which of the three scenarios happened based on the story?

Edit:

Output from git log --oneline --graph develop :

 * 2ebb938 misc * 69f95f6 Merge 'feature/x' into 'develop' merge conflicts |\ | * 8b9b275 Merge 'develop' with feature/x; minor merge tweaks | * eb89630 misc | * 54884d2 misc | * 76f02bb Merge branch 'develop' into feature/x | |\ | * | d06d673 misc | * | 0ba5235 misc * | | 5489590 misc * | | a215bd2 misc * | | 4aacaa7 misc * | | e553bf0 resolved merge conflicts |\ \ \ | * | | 6b30050 fixed test db error | * | | 64909f9 Merge branch 'develop' into feature/a | |\ \ \ | * \ \ \ e7319e1 Merge branch 'develop' into feature/a | |\ \ \ \ | * | | | | 410786b misc | * | | | | 67267f3 misc | * | | | | ae4b800 misc | * | | | | 9e281eb Merge branch 'develop' into feature/a | |\ \ \ \ \ | * | | | | | f8fa2ec misc * | | | | | | 7a0ad6b Merge branch 'feature/b |\ \ \ \ \ \ \ | * | | | | | | 02558b6 ready to merge | * | | | | | | cc07f79 Merge branch 'develop' into feature/b | |\ \ \ \ \ \ \ | | | |_|_|/ / / | | |/| | | | | | * | | | | | | 4b6610f misc | * | | | | | | 25e509b Merge branch 'develop' into feature/b | |\ \ \ \ \ \ \ | | | |_|_|/ / / | | |/| | | | | | * | | | | | | df5640d merged with develop 
+6
source share
1 answer

It looks like you merged branch A primarily in 7a0ad6b . Not quite sure what happened after that. According to your git log output, it looks like you could combine B into the development of e553bf0 :

 * | | e553bf0 resolved merge conflicts |\ \ \ | * | | 6b30050 fixed test db error | * | | 64909f9 Merge branch 'develop' into feature/b 

But according to your reflog, 6b30050 is actually feature/a :

 6b30050 HEAD@ {43}: checkout: moving from develop to feature/a e553bf0 HEAD@ {44}: commit (merge): resolved merge conflicts 

You didn’t accidentally mix up the branch names when you copied the output to your question, right?

Looking only at reflog

Depending on your original reflog , it looks like you first merged branch B into develop , then tried to merge branch A , resolved the conflicts, and then committed:

 # Checkout develop e553bf0 HEAD@ {42}: checkout: moving from feature/a to develop # Checkout branch A 6b30050 HEAD@ {43}: checkout: moving from develop to feature/a # Merge branch A? Resolve conflicts and commit e553bf0 HEAD@ {44}: commit (merge): resolved merge conflicts # Checkout develop 7a0ad6b HEAD@ {45}: checkout: moving from feature/a to develop # Checkout branch A 6b30050 HEAD@ {46}: checkout: moving from develop to feature/a # Merge branch B into develop 7a0ad6b HEAD@ {47}: merge feature/b: Merge made by the 'recursive' strategy. # Move from branch B to develop (ie checkout commit 921ae46) 921ae46 HEAD@ {48}: checkout: moving from feature/b to develop 

View merged branch history

When you find out which merge is there, you should be able to view the branch log using

 git log --oneline --graph <sha of merge into develop>^2 

which means showing the history of the second merge parent, which will be the end of the function branch if you use the git thread.

If this helps, you can also view the history of develop branches with the commit date and date using this alias in the user's .gitconfig file:

 [alias] datelog = log --format=\"%C(yellow)%h%C(reset) %C(cyan dim)%ad %C(red bold)%cd %C(reset)%s\" --graph 

It will show you the author date first in blue, and then the date of fixation in red. Using the commit date, you could find out if branch A or B merged for development in the first place. You can also get both copyright and fixed dates using git log --format=fuller .

Use merge rebalancing (usually)

Finally, do you know how to rebase ? You can avoid polluting your branch history with a sync / merge commit using develop , using rebase for synchronization instead of merge :

 # From feature branch X, sync with develop git rebase develop # Switch to develop and merge # (either fast-forward or merge commit, your choice) git checkout develop git merge --no-ff X 
+4
source

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


All Articles