Init git repository
git init
git add README
git commit -m "first commit"
git remote add origin git://github.com/gelu77/MyRepo1.git
Clone from an existing git repository
git clone git://github.com/gelu77/MyRepo1.git
Commit the changes of tracked files
git commit -am "change for tracked files"
Push the local changes to remote repository
git push -u origin master
Pull the remote changes into the local repository
git fetch origin
git merge origin/master
Or the simple command
git pull origin
How do you discard unstaged changes in git?
git stash save --keep-index
git stash drop
git checkout path/to/file/to/revert
git checkout -- .
git clean -df & git checkout -- .
git: undo all working dir changes including new files
git reset --hard # removes staged and working directory changes
git clean -f -d # remove untracked files
Removing multiple files from a Git repo that have already been deleted from disk
git add -u
git ls-files --deleted | xargs git rm
git commit