| +34 608 61 64 10



Git - Tip and tricks branch

In this post I'll show some usefull commands to manage the GIT branch. I'll show only the commands without explain them. It's only a reminder ;)
Note: This post will be updated with new tips when I'll use new of them
Case 1) How to pull a branch in local from remote and how to merge it

git fetch origin
git pull origin NameOfBranch
git checkout LocalBranch
git merge origin/NameOfBranch

Case 2) How to merge a branch (branchOne) to the other (branchTwo)

git checkout branchTwo
git pull
git checkout branchOne
git merge origin/branchTwo

Case 3) How pull all the branches.

git pull --all

Case 4) How to sincronize a branch from remote to local

Git fetch: sincronizza tutte le branch in local 
Password for '': 
remote: Counting objects: 1049, done.
remote: Compressing objects: 100% (632/632), done.
remote: Total 1049 (delta 607), reused 539 (delta 291)
Receiving objects: 100% (1049/1049), 257.78 KiB | 0 bytes/s, done.
Resolving deltas: 100% (607/607), completed with 72 local objects.
   cc19162..8725088  master     -> origin/master
 * [new branch]      accoutnableDataUser -> origin/accoutnableDataUser
   b5a87e9..87d4760  asdf   -> origin/asdf
 * [new branch]      csv_export -> origin/csv_export
   a77e17f..7172578  desarrollo_pablo -> origin/desarrollo_pablo
   b16c787..506f82f  design     -> origin/design
   2e7afba..12fae8d  new_desarrollo -> origin/new_desarrollo

Then I move to asdf using this command:

git checkout asdf