Monday, June 20, 2011

Add Branch to Git.

--------------------------------------------------------
vi  /usr/bin/addbranch   <---Create the file with name, and copy the following code.

#!/bin/bash
# git-create-branch

if [ $# -ne 1 ]; then
         echo 1>&2 Usage: $0 branch_name
         exit 127
fi

set branch_name = $1
#git push origin origin:refs/heads/${branch_name}
#git fetch origin
git checkout --track -b ${branch_name} origin/${branch_name}
git pull

--------------------------------------------------------------




Do
chmod 777 /usr/bin/addbranch


and create new branch like:
from checkouted code.

addbranch

1 comments:

Renu said...

Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.
Devops Training in electronic city