pt
Push up to a specific commit. This function pushes the current branch up to a specific commit hash. My main use case for this is when making changes to a branch which already has a Pull Request in Azure DevOps. The changes in each push can be reviewed as separate updates to the PR, so I can make a series of commits then push them as multiple logical updates for easier review.
I based this alias on https://coderwall.com/p/hexinq/git-push-up-to-a-certain-commit
Usage:
git pt abc123
CLI Command
git config --global alias.pt "!f() { BRANCH=`git symbolic-ref --short HEAD`; git push -u origin ${1}:refs/heads/$BRANCH; }; f"
.gitconfig Snippet
[alias]
pt = !f() { BRANCH=`git symbolic-ref --short HEAD`; git push -u origin ${1}:refs/heads/$BRANCH; }; f