Git in Practice

Gitignore listing

# First, ignore everything
# Now, whitelist anything that's a directory
# And all the file types you're interested in.

Push new branch to GitHub

git push -u origin <branch>

Merge from forked


git remote -v

git remote add upstream

git remote -v

git fetch upstream

git branch -va

git checkout master

git merge upstream/master

GitHub hard reset fork to upstream

git remote add upstream /url/to/original/repo
git fetch upstream
git checkout master
git reset --hard upstream/master  
git push origin master --force 

Delete branch

git branch -a
git branch -d test
git branch -D test

git push origin --delete test

Create empty branch

git checkout --orphan empty-branch

git rm -rf .

git commit --allow-empty -m "root commit"

git push origin empty-branch