Showing posts with label git. Show all posts
Showing posts with label git. Show all posts

Thursday, June 26, 2008

Git: working with branches

The way we work with git is that for every remote pair programming session we create a separate branch. We give it a name after the feature we're working on.


git checkout -b feature1


It automatically switches to this branch.

During our work we tend to checkin our changes quite often. We do it with:


git checkin -a -m "created some specs for class A"


After we finish our session, we do two things.
First, we merge our branch to master:


git checkout master
git merge feature1


Then, we delete the branch we were working on:


git branch -D feature1


That's it.

If you happen to delete the branch BEFORE you merge it, don't panic, there is a solution.
In order to undelete a branch just after you deleted it, do:


git checkout -b new_branch_name HEAD@{1}