"Cherry pick" all changes required to make same as another branch:
git merge --squash -X theirs <other_branch>
Makes no commit, but stages all changes
"Cherry pick" all changes required to make same as another branch:
git merge --squash -X theirs <other_branch>
Makes no commit, but stages all changes
To get the Git top level, or root, of the repo:
git rev-parse --show-toplevel
Get the current current branch name:
git rev-parse --abbrev-ref HEAD
Get the current working directory relative to project root:
echo "${PWD##$(git rev-parse --show-toplevel)}"
Get the current working directory relative to project root and the branch name in one line:
echo "${PWD##$(git rev-parse --show-toplevel)} [$(git rev-parse --abbrev-ref HEAD)]"