#Useful goodies for GIT Command-line
Dangerous commands (e.g. you can lose your work) are labelled ⚠.
##Making local copy of a repo
$ git clone git@github.com:reflexdemon/demo.git
##Checkout to a Specific Branch/Tag/commit
$ git checkout <branch-name>/Tag/#commit-hash#
##Create a new branch with a specific commit on existing branch ⚠
$ git checkout <existing-branch>
$ git checkout #commit-hash#
$ git checkout -b <new-branch-name>
$ git diff --name-only #commit-hash#
or
$ git diff --stat #commit-hash#
$ git branch -r
$ git push origin :my-branch
$ git tag -d 12345
$ git push origin :refs/tags/12345
⚠
$ git clean -f -d
$ git branch -d my-branch
$ git push origin newfeature
$ git branch -m old_branch new_branch
git fetch
followed by git checkout -b my-branch origin/my-branch
⚠
$ git pull
$ git checkout <trgetted-branch>
$ git pull
$ git reset --hard <commit you want to be>
$ git push -force
See: https://help.github.com/articles/duplicating-a-repository/
$ git clone --bare https://github.com/exampleuser/old-repository.git
# Make a bare clone of the repository
$ cd old-repository.git
$ git push --mirror https://github.com/exampleuser/new-repository.git
# Mirror-push to the new repository
$ cd ..
$ rm -rf old-repository.git
# Remove our temporary local repository
See: https://help.github.com/articles/duplicating-a-repository/
$ git clone --mirror https://github.com/exampleuser/repository-to-mirror.git
# Make a bare mirrored clone of the repository
cd repository-to-mirror.git
$ git remote set-url --push origin https://github.com/exampleuser/mirrored
# Set the push location to your mirror
$ git fetch -p origin
$ git push --mirror