Skip to content

Instantly share code, notes, and snippets.

@chathudan
Last active April 16, 2019 06:10
Show Gist options
  • Save chathudan/934bc2a11ccc98d649f110ad4ba5c3bd to your computer and use it in GitHub Desktop.
Save chathudan/934bc2a11ccc98d649f110ad4ba5c3bd to your computer and use it in GitHub Desktop.
Useful Git Commands

Git Tag

  1. Checkout the tag (a Detached HEAD)

    git checkout tag/v1.1

  2. Create and Checkout a branch off that tag (i.e. Branching off the tag)

    git checkout -b my-tagged-branch

*** do work and commit changes ***

  1. Push to the remote branch.

    git push -u origin my-tagged-branch If needed merge branch into other branches that need the change (in case of a bug fix for example)

  2. While still on my-tagged-branch, Delete the tag

    git tag -d v1.1

  3. Create the tag again: This will "move" the tag to point to your latest commit on that branch

    git tag v1.1

  4. Delete the tag on remote

    git push origin :v1.1

  5. Create the tag on remote

    git push origin v1.1

Git URL

  1. Change remote orgin git remote set-url origin https://github.com/USERNAME/REPOSITORY.git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment