scripts/git/README.md

83 lines
2.9 KiB
Markdown
Raw Permalink Normal View History

2017-09-23 06:27:51 +02:00
The scripts in this directory are designed to be installed as new git
sub-commands. To do so, install the scripts in a directory within your `PATH`
(or add the repository's `bin` directory to your `PATH`, see the main
`README.md`), and use `git config` to add aliases:
git config --global alias.changelog "\!sh -c 'git-changelog'"
git config --global alias.cherry-move "\!sh -c 'git-cherry-move'"
git config --global alias.merge-ff-only "\!sh -c 'git-merge-ff-only'"
git config --global alias.tag-update "\!sh -c 'git-tag-update'"
git-changelog
=============
`git-changelog` allows one to build a changelog file from the tag messages. The
tags considered are those whose names follow the format `vX.Y[.Z[...]]` (for
example v1.2, v0.0.1, v4.3.2.1, etc.).
One can edit the options into the script to change the message displayed at the
top of the changelog, and the number of lines that will separate two tag
messages.
The changelog is displayed on the standard output, in reverse order (higher
version numbers first), whereas the error output displays the included or
skipped tag names (i.e. those that don't correspond to the pattern).
Note that if there is no tag at all in the repository, no particular warning
will be displayed.
git-cherry-move
===============
`git-cherry-move` is like `git cherry-pick`, but it moves the commit instead of
copying it.
It is designed to move a single commit from a branch head to another branch
head. It is the equivalent of git cherry-pick followed by git reset.
Usage:
git-cherry-move source_branch destination_branch [ reset-arg ]
`reset-arg` is passed as the first argument of `reset`, so please be careful!
So to move the last commit of `source_branch` on top of `destination_branch`,
simply type:
git-cherry-move source_branch destination_branch
After this, you will be on `source_branch`, the HEAD being on the parent of the
old `source_branch` head. The changes introduced by the moved commit are not
deleted from the file system (soft reset).
If you want these changes to be deleted (hard reset), use `--hard` as the
*last* argument:
git-cherry-move source_branch destination_branch --hard
git-merge-ff-only
=================
`git-merge-ff-only main_branch topic_branch` is the equivalent of the following
commands:
git checkout main_branch && git merge --ff-only topic_branch
except that `main_branch` is not checked out. The reference is updated directly
(if possible), and HEAD stays on whichever branch was checked out before
running the command.
git-tag-update
==============
`git-tag-update` allows one to update a tag message while automatically keeping
its original date. It takes the name of the tag to update as an argument.
Beware that the tag's author will be changed to whoever is the current author.
You can change it temporarily with `git config` if you need to update commits
with different authors.