Skip to content

Instantly share code, notes, and snippets.

@joseluisq
Last active November 18, 2015 15:47
Show Gist options
  • Save joseluisq/e9e0b7eaff7cfc850afa to your computer and use it in GitHub Desktop.
Save joseluisq/e9e0b7eaff7cfc850afa to your computer and use it in GitHub Desktop.
Git useful commands

Lists all files for the last commit (HEAD)

git show --name-only --oneline HEAD

Delete a remote git tag

git tag -d v1.0.0
git push origin :refs/tags/v1.0.0

Fetch remote git tags only

git fetch --tags

Push remote git tags only

git push origin --tags

Create remote name (for example: origin)

git remote add origin http://github.com/repo.git

Show the last commit

git log -1 HEAD

Show the last commit hash in short version

git rev-parse --short HEAD

Delete the last commit from HEAD

git reset --hard HEAD~1

Pull down one commit worth of historical data

git clone --depth=1 https://github.com/angular/angular-seed.git <your-project-name>

Clone and switch from one specific remote branch

git checkout -b gh-pages origin/gh-pages

Unstage all files

git reset .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment