m_marce_e
m_marce_e

Reputation: 41

git log --graph does not show branches, it only shows them as commits on master

A time ago, at the institution I work for, the log graph of git used to show the commits in each branch before merging them into master, but now when we merge a branch it only shows them as commits on master, and does not show the history of the branches This did not happen before. Why is it happening this way? Thank you

* commit 
| 
| 
| 
|    
|  
* commit 
| 
| 
| 
|    
|  
* commit 
| 
| 
| 
|     
|  
* commit 
| 
| 
| 
|     
|  
* commit 
| 
| 
| 
|  
|  
* commit 
| 
| 
| 
|     
|  
* commit
| 
| 
| 
| 
| 
* commit
| 
| 
| 
|    
|  
* commit 
| 
| 
| 
|     
|  
* commit 
| 
| 
| 
|     
|  
* commit 
| 
| 
| 
|     
|  
* commit 
| 
| 
| 
|     
|  
* commit
| 
| 
| 
|    
|  
* commit
| 
| 
| 
|     
|    
*   commit 
|\  
| | 
| | 
| | 
| |     
| |   
| * commit 
| | 
| | 
| | 
| |     
| |   
* | commit 
|/  
|   
|   
|       
|  
* commit 
| 
| 
| 
|     
|    
*   commit
|\  
| | 
| | 
| | 
| |    
| |     
| *   commit
| |\  
| | | 
| | | 
| | | 
| | |     
| | |    
| | * commit
| | | 
| | | 
| | | 
| | |     
| | |    
| | * commit
| | | 
| | | 

git_log_graph

Upvotes: 1

Views: 2481

Answers (2)

LeGEC
LeGEC

Reputation: 51820

Your question is not entirely clear, but I think you are looking for one of git log's options :

  • to add the name of branches and tags in your log, use --decorate :
    git log --graph --decorate

  • to have a view of all branches in your repo, use --all :
    git log --graph --all

Note that you can combine both :

git log --graph --all --decorate

Upvotes: 3

m_marce_e
m_marce_e

Reputation: 41

By default, Git attempts to perform a "fast-forward" merge, where it will basically take the commits from one branch and replay them atop the merge target. This only works if the merge target has had no commits made to it in the meantime (iirc), but it means that the branch being merged in is effectively removed from the process, Git can just fast-forward master up to meet its tip without actually doing any merging.

You can disable this feature with 'git merge --no-ff'

Upvotes: 2

Related Questions