Combined git `continue` command

前端 未结 2 1144
不知归路
不知归路 2021-01-19 05:10

Variously I might need to run:

  • git rebase --continue
  • git cherry-pick --continue
  • git revert --continue<
2条回答
  •  深忆病人
    2021-01-19 05:21

    Such a command does not exist, to my knowledge. However you could create a script for that, called e.g. git-continue:

    #!/usr/bin/env bash
    
    repo_path=$(git rev-parse --git-dir 2>/dev/null)
    
    if [ -d "${repo_path}/rebase-merge" ]; then
        git rebase --continue
    elif [ -d "${repo_path}/rebase-apply" ]; then
        git rebase --continue
    elif [ -f "${repo_path}/MERGE_HEAD" ]; then
        git merge --continue
    elif [ -f "${repo_path}/CHERRY_PICK_HEAD" ]; then
        git cherry-pick --continue
    elif [ -f "${repo_path}/REVERT_HEAD" ]; then
        git revert --continue
    fi
    

    Put the script somewhere in your $PATH, and then you can use git continue.

    Note that there are similar flags like --continue, for example --abort, --skip, --quit, which you might want to cover as well.

提交回复
热议问题