Get current branch name
git rev-parse --abbrev-ref HEAD
Get descriptive name
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}
Tag descriptive or COMMIT_SHORT_ID with branch name
echo $(git describe --tags --dirty 2> /dev/null || echo $(git rev-parse --abbrev-ref HEAD)"-"$(git describe --dirty --always))
Cases: everyting like "descriptive names", but: - no tag ever added: ${BRANCH}-${COMMIT_SHORT_ID} - no tag ever added, and working directory changed: ${BRANCH}-${COMMIT_SHORT_ID}-dirty
Transfer commits between repos
## Export git format-patch --output-directory "../patches" $sha1_from~..$sha1_to
## Restore git am -3 ../patches/*