Quantcast
Channel: Web Technologies » Hints-n-Tips
Viewing all articles
Browse latest Browse all 10

Git branching tidbits

$
0
0

Following a discussion on how to have multiple branches of development going on at the same time, without affecting each other, here are some practical commands when using git.

Create a new branch and switch to it immediately

git checkout -b branchName

Make origin track the branch, to enable argument-less pushes and pulls

git push -u origin branchName

And finally to avoid merging trouble: before merging to master branch, merge master into your own branch. This allows you to test the latest changes to master since the branching point before your changes hit master. Once any conflicts are resolved and tests are passing, you can safely merge back to a stable master, like this:

git pull
git checkout myBranch
git merge master
// 1. resolve any conflicts
// 2. run tests
// 3. perform any manual integration tests
git checkout master
git merge myBranch
git push

Viewing all articles
Browse latest Browse all 10

Latest Images

Trending Articles



Latest Images