• Init an empty repository.
1
git init
  • add remote, using http or ssh method
  • origin is just a naming for your remote
1
git remote add *origin* {url}
  • fetch all from remote
1
git fetch --all
  • reset everything to your online repository
  • –hard will delete all your local changes!
1
git reset --hard *origin*/{branch_name}
  • show list of branches
1
git branch
  • switch or create branch
1
git checkout {branch_name} 
  • pull from remote, might need to fix commits
1
git pull
  • rebase, add in changes and align with commit dates
1
git pull --rebase
  • merge, add a merge commit message to show all the changes
1
git pull --merge
  • stage all your changes, add . is stage all changes, you can add specific if needed
1
git add .
  • commit your staged changes
1
git commit -m "{commit_message}" 
  • push your commits to online repo
1
git push origin {branch_name}

I actually prefer using git client such as Fork, so you can get rid of all these commands