Skip to content

Instantly share code, notes, and snippets.

@kampfgnu
kampfgnu / rename_git_branch
Created April 24, 2013 08:19
rename git branch
//First, in your working tree, locally rename master to something else.
git branch -m master old-dev
//Renaming a branch does work while you are on the branch, so there's no need to checkout something else.
//Then, locally rename the maintenance branch (2.63-branch) to master:
git branch -m 2.63-branch master
//Now, time to mess with the remote. Just in case you screw up, you might want to make sure you have a current backup. First, //delete the remote's master:
git push origin :master
@kampfgnu
kampfgnu / push_remote_and_upstream
Created April 24, 2013 08:10
push local git branch to remote and set upstream
git push origin <branchname>
git branch --set-upstream <branchname> origin/<branchname>
@kampfgnu
kampfgnu / gist:5362858
Last active December 16, 2015 02:29
init empty git repo on my ubuntu machine
//server side:
GIT_DIR=project.git git init
cd project.git
git --bare update-server-info
cp hooks/post-update.sample hooks/post-update
//on client side:
git clone ssh://<username>@<remote-git-hostname>/path/to/dir.git
//on first push to master: