GIT

Git in Practice

Gitignore listing

# First, ignore everything
*
# Now, whitelist anything that's a directory
!*/
# And all the file types you're interested in.
!*.one
!*.two
!*.etc

Push new branch to GitHub

git push -u origin <branch>

Merge from forked

link

git remote -v

git remote add upstream https://github.com/otheruser/repo.git

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