GIT, showing the branches on the bitbucket tree

6

Hello! I've been searching for days and found no information that helps me.

My problem is with displaying the tree of commits and branchs on bitbucket.

I create a branch from the master git checkout -b develop I am doing the commits and then I go back to the master and merge the develop.

I would like you to have a chart like the example below:

* merged from develop
|\
| * - commit 5
| * - commit 4
| * - commit 3
| * - commit 2
| * - commit 1
|/
* branch master

Butonlyonestraightlineremains

**-commit5*-commit4*-commit3*-commit2*-commit1*-branchmaster

At first I can only do as I like the pull request from bitbucket itself, but I would like to do it by command line in git-bash.

Thank you in advance!

    
asked by anonymous 28.06.2016 / 09:07

3 answers

0

Through some links here in English I found one question in which I discovered the name of the git function I was looking for, if it is called "FAST-FORWARD" I left it as default disabled in git git config --global merge.ff false

Thanks for everyone's cooperation

    
28.06.2016 / 23:46
4

Just do the merge without fast-foward . You can do this with the following command: git merge develop --no-ff . the --no-ff guarantees that when doing the merge, a new commit will be generated.

If you want to view the tree on the command line, just as you see it on Bitbucket, just run this command:

git log --graph --all --oneline --decorate
  • --graph shows in graph form
  • --all indicates that all branch s will be shown
  • --oneline defines that only the first line of the commit will be shown and the abbreviated commit hash
  • --decorate ensures branch s names will appear

Finally, you can still create a alias to facilitate future command typing with git config --global alias.graph "log --graph --all --oneline --decorate" and then only run alias with git graph .

The result of the command is more or less what appears in the image below:

    
30.06.2016 / 04:49
2

That's how you work.

In case, when you work in the same branch (master), it follows a current line.

To work in parallel, you have to create a new branch from the master.

  

seupport (master): git checkout -bPRO-01-nome-branch-mudanca .

And then start working on the ticket. Then, finish it, commit the changes:

  

yourproject (PRO-01-branch-name-change): git commit -am"PRO-01 mudanças feitas xyz #resolve" .

Then send the branch to bitbucket:

  

Yourproject (PRO-01-branch-name-change): git push origin PRO-01-nome-branch-mudanca

Next, checkout the master, staging or deploy (depends on how it works):

  

Yourproject (PRO-01-branch-name-change): git checkout master

Bring your updates to others:

  

seuproject (master): git pull origin master

Merge the changes with the master:

  

seuproject (master): git merge PRO-01-nome-branch-mudanca

Resolve conflicts (if hover):

  

git diff [branch_1]:file-exemplo [branch_2]:file-exemplo

After resolving the conflicts (if any) commit the resolution.

  

seuproject (master): git commit -am"PRO-01 conflitos resolvidos"

And finally, push the master:

  

seuproject (master): git push origin master

PS: See if on bitbucket, you are listing all commits in the filter:

link

    
28.06.2016 / 22:29