Skip to content

Instantly share code, notes, and snippets.

@lucijafrkovic
Last active January 20, 2024 17:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save lucijafrkovic/ab1146df309004e6b9e916fce9074e31 to your computer and use it in GitHub Desktop.
Save lucijafrkovic/ab1146df309004e6b9e916fce9074e31 to your computer and use it in GitHub Desktop.
Add custom git command (Windows)

Creating a custom git command in Windows

  1. create a cmd/bat file with the command. E.g. retag.cmd, save it in C:\git-scripts for example

  2. add your git commands to the file. For example, this set of commands deletes the specified tag from your current branch both locally and remotely, then tags it with the same tag and pushes the change remotely

    git tag -d %1

    git push origin :refs/tags/%1

    git tag %1

    git push origin tag %1

  3. run this command from your console

    git config --global alias.retag '!C:/git-scripts/retag.bat'

  4. use your custom command

    git retag V_10_2

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