Skip to content

Instantly share code, notes, and snippets.

@cybersamx
Last active August 29, 2015 14:04
Show Gist options
  • Save cybersamx/c3754c0b4f728cbb3c15 to your computer and use it in GitHub Desktop.
Save cybersamx/c3754c0b4f728cbb3c15 to your computer and use it in GitHub Desktop.
Git Primer
# Find the remote origin
git remote show origin
git config --get remote.origin.url
# Describe the git repo (only works if there're tags added to the repo)
# Output: [nearest_tag_name]-[number_of_commits]-g[commit_identifier]
git describe
# List of tags
git tag # List of local tags
git show-ref --tags -d # List of tags and commits
git ls-remote --tags origin # List of remote tags and commits
# Push tags to origin
git push --tags
# Add a remote to the local git
git remote add origin https://github.com/user/repo.git
# List of remote repos
git remote -v
# Stash everything that you haven't previusly added.
git stash --kep-index # First, git add the things you want to keep, then run this command.
git stash --patch # Interactive mode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment