git

Version control ecosystem

Get current branch name

git rev-parse --abbrev-ref HEAD

Get descriptive name for the current worktree

git describe --tags --dirty --always

Cases:
- no tag ever added: ${COMMIT_SHORT_ID}
- no tag ever added, and working directory changed: ${COMMIT_SHORT_ID}-dirty
- tag with clean working directory: ${TAG}
- if tree changed since last tag: ${TAG}-dirty
- commit added since last tag: ${TAG}-${NUMBERS_OF_COMMIT_SINCE}-${COMMIT_SHORT_ID}

Transfer commits between repos

## Export
git format-patch --output-directory "../patches" $sha1_from~..$sha1_to

## Restore
git am -3 ../patches/*