Push changes to remote repo without commit

前端 未结 4 538
清歌不尽
清歌不尽 2021-02-02 08:09

Is it possible to push changes to a remote repository without commiting to the master branch? I use the remote repo just for deploying.

相关标签:
4条回答
  • 2021-02-02 08:31

    You can create an empty commit and push that: git commit --allow-empty

    0 讨论(0)
  • 2021-02-02 08:37

    No, you must make a commit before you can push. What is being pushed is the commit (or commits).

    0 讨论(0)
  • 2021-02-02 08:38

    No, there is no way to do that, as it would completely oppose the whole "git strategy", I guess. I don't know about your deployment system, but I guess a good way to do what you are trying to is to work on different branches (that is, on for development and one which gets deployed when pushed to), and merging the changes you want to be deployed from your development-branch into your live branch.

    0 讨论(0)
  • 2021-02-02 08:48

    If you want to push a specific commit:

    git push <remotename> <commit SHA>:<remotebranchname>
    
    0 讨论(0)
提交回复
热议问题