Create a new repository on GitHub. Then locally inside the source directory
#echo "# openqmail" >> README.md $ git init $ git add README.md $ git commit -m "initial commit" $ git remote add origin https://github.com/kai-peter/openqmail.git $ git push -u origin master
$ git remote add origin https://gitlab.com/kaili/qwebsite.git $ git push origin master
$ git config user.name "Kai Peter" $ git config user.email user@example.org
$ GIT_COMMITTER_NAME='kp' git commit --author="Kai Peter <user@example.org>" -m "Initial version" $ git remote add origin https://github.com/kp-org/eQmail.git
Create a new branch “dev” (from master) on GitHub. Clone the repo and switch to branch “dev”:
$ git clone https://github.com/kp-org/eQmail.git $ git checkout -b dev $ git branch $ * dev $ master
Merge a dev branch into master
$ git checkout master $ git merge dev
Delete the merged (old) branch (example: dev):
$ git branch -d dev
Checkout an older state: Create a new branch and check it out:
$ git checkout -b <branch> a9c146a09505837ec03b
Make changes and upload to remote GitHub repo:
$ git add * $ git add .gitignore $ git commit -a -m "<comment>" $ git push origin dev
Hint::  git add 
doesn't show what was added. Use  git status 
to see what was added.
Do not track changes at '.gitignore':  git update-index –assume-unchanged .gitignore 
Thus '.gitignore' have not be committed, but changes are the repo.
Remove file from .git only:
$ git rm --cached <file>
Remove file completely: This removes <file> from filesystem too!
git rm <file>
Remove all untracked files and directories (-d):
git clean -fd
Remove files from/after git add:
$ git reset [*|file]
Edit comment of last commit or (optional) an older commit:
$ git commit --amend [-c <commit-hash>]
Undo last commit:
$ git commit -m "Something terribly misguided" (1) $ git reset HEAD~ (2) << edit files as necessary >> (3) $ git add ... (4) $ git commit -c ORIG_HEAD (5)
Reset to an older commit:
git reset <commit-hash>
Get changes from remote repository (rebase, re-staging):
$ git pull https://github.com/kp-org/xdkim.git