I have two workplaces where I work in a project where I use the GIT version control. In my studies I learned some things about GIT using BitBucket.
Let's think about the following scenario:
- My branch to deploy is the "master".
- Whenever I'm developing I'll be in a "dev" branch.
- Home Computer.
- Office Computer.
I'm working from home on a first improvement and for this I first create the "dev" branch.
git branch dev
git checkout dev
Ok, I made the improvements, I made the commits in the dev branch and now I'm going to send everything to the bucket bit (remembering that I'm in the dev branch)
git push origin dev
I submitted my changes to Bit Bucket and now I have to go to the Office to work on it.
Arriving in the office I make the clone of my repository and at first it will come empty since there I will be in the master branch. Then I give the command to see all the branches
git branch -a
And I have as a result
remotes/origin/HEAD -> origin/master
remotes/origin/master
remotes/origin/dev
Then I create a branch on the office computer based on the remote branch dev
git checkout -b dev origin/dev
I make changes to my project from the office computer, commit these improvements, and send the server to the dev branch
git push origin dev
Now I'm going home and I'm going to continue working on the project. Then I give the git pull command to download the latest changes. Except that I already have the dev branch on my home computer. So I do the following:
git ckeckout -b dev_escritorio origin/dev
Ok, now I have the version in this branch (dev_description) with the improvements I made there. I just want to continue the improvements through my dev branch so I would:
git checkout dev
git merge dev_escritorio
Well that's it, I was wondering if this is really the best way when you have to work with two different computers using git, branch, etc.