Skip to content

A simple git hooks to move tags between commits rewrited by amend or rebase command

License

Notifications You must be signed in to change notification settings

maastiff/git-rebase-autotags

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

git rebase autotags

As explained in this old thread, git does not provide a way to move tags between commits during amend or rebase.

The provided git-rebase-autotags.py script is a simple post-rewrite git hook which will be called after a commit has been modified by git amend or rebase command to move tags from old commit to new one.

INSTALL

Locally in repository

You can easily install this hook in your git repository following these steps:

  1. Copy git-rebase-autotags.py inside .git/hooks directory of your repository
  2. Rename git-rebase-autotags.py as post-rewrite in order to be automatically executed by git
  3. Make sure the hook is executable
chmod a+x .git/hooks/post-rewrite

Globally on computer

You can use the git template functionnality to provide git-rebase-autotags hooks accross all your repositories.

  1. Configure git templates
git config --global init.templatedir '~/.git-templates'
mkdir -p ~/.git-templates/hooks
  1. Copy git-rebase-autotags.py inside ~/.git-templates/hooks directory

  2. Rename git-rebase-autotags.py as post-rewrite

  3. Make sure the hook is executable

chmod a+x ~/.git-templates/hooks/post-rewrite
  1. Re-initialize git in each existing repo you'd like to use this in
git init

WARNING: if you already have a hook defined in your local git repo, this will not overwrite it.

CONFIGURE

The autotags functionnality is disabled by default. You can easily enable it adding rewrite.autotags.enabled = true in your local or global configuration.

git config [--global] --add rewrite.autotags.enabled true

It is recommended to enable git push.followTags feature which will prevent you to have to separately call git push --tags to push your tags.

git config --global push.followTags true

About

A simple git hooks to move tags between commits rewrited by amend or rebase command

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages