I have created a repository (test_repo) under a project (test_pro) in bitbucket from my laptop. I have created 3 branches: master (default), backend, frontend.
Now I want to do all my backend-work (php code) from my laptop and want to push to backend branch. And I want to do all frontend-work (html,css) from my office desktop computer and want to push to frontend branch.
Now how can I connect to my repositary and do push and pull operation from my laptop and desktop computer using git bash.
I am new to this VCS. I am trying to learn.
first you need to create a ssh key for each computer. in linux or mac you can use the command ssh-keygen. after that you need to add each public key to your bitbucket account.
Next you need to clone the repository in each computer an checkout the corresponding branch. lets configure everything from your laptop:
git init
echo "this is the repo" >> readme.md
git add -A
git commit -m 'initial commit'
git remote add origin git@bitbucket.org:you/yourrepo.git
git push -u origin master
git checkout frontend
echo 'this is the frontend' > readme.md
git add -A
git commit -m "this it's the first commit in the frontend"
git push -u origin frontend
git checkout backend
echo 'this is the backend' > readme.md
git add -A
git commit -m "this it's the first commit in the backend"
git push -u origin backend
in your desktop pc:
git clone git@bitbucket.org:you/yourreponame.git
git checkout origin/frontend