#!/bin/bash
# creating and switching to the new branch
git branch <branch_name>
git checkout <branch_name>
# after commit push branch to remote repo
git push -u origin <branch_name>
# listing branches
git branch -a
# now you can git pull and git push as much as you want on this branch
# let's say this is done, we did our unit tests and all work well, let's merge with master:
#first let's switch to master
git checkout master
git pull origin master
#To be sure, let's see if we've had a merged branch before :
git branch --merged
git merge <branch_name>
git push origin master
# deleting a branch
#LOCAL
git branch --merged
git branch -d <branch_name>
git branch -a
# remote
git push origin --delete <branch_name>
# if stale branch
git branch -rd <remote>/<branch_name>
# need to jump on master for some pull request etc?
git stash save "put your message here"
git checkout master
# do what you have to do here...
git checkout <branch_name>
git stash list
# if you have more than one stash you'll see the listing, ans if you want to use one stash in particular:
git stash apply <stash@{0 | 1 etc....}>
# if you just want the last one and remove at the same time the stach number
git stash pop
# to remove the full list
git stash clear