编译机器的Git工作流程

Tim*_*myJ 2 git

我在一个需要很长时间编译的大型软件上工作.我经常发现自己在本地开发,然后在一台强大的远程机器上编译/运行.Git使这一切变得非常简单:我在本地提交,然后在远程上的git repo上拉那个分支.不幸的是,我在编写代码时犯了错误,经常发现自己正在修改拼写错误以及编译过程中出现的其他小错误.这些微提交使我的日志变得混乱和混乱.我正在寻找一种方法,我可以这样做:

#local> git commit -m "My useful commit message and the bulk of my commit"

#remote> git pull local development_branch
#remote> *compile my code and get a stupid error*

#local> *fix error*
#local> git add *fixed file*
#local> git commit --amend

#remote> *force an update to remote that causes it to look like master*
Run Code Online (Sandbox Code Playgroud)

所以,我正在寻找一个执行最后一步的命令,即在我修改提交后将我的遥控器更新为看起来像我的本地分支.我这样做的当前方式是做

git reset --hard HEAD~1
git pull local development_branch
Run Code Online (Sandbox Code Playgroud)

这有效,但看起来真的很难看.有没有更好的方法来完成我想要做的事情?

Amb*_*ber 5

而不是"回到过去"然后重新拉动,只需直接重置到遥控器的位置:

git fetch local
git reset --hard local/development_branch
Run Code Online (Sandbox Code Playgroud)