使用 git 编辑远程分支



我目前正在学习 git,但我完全迷失了:

我想执行以下操作:

  • 我想使用 git 来获取和编辑(推送到)远程分支。

我该怎么做?

我想做以下事情:

git branch -a
then 
git checkout remote/branch_name
git add .
git commit -m "..."
git push (which would push to the remote)

你是这样做到的吗>

如果更改存储库的历史记录,则远程推送将被拒绝。您必须强制推送。

您正在使用的 git 命令

git branch -a
then 
git checkout remote/branch_name
git add .
git commit -m "..."
git push (which would push to the remote)

可以将新提交添加到存储库,并且不会更改历史记录。

你可以用

git rebase -i <commit>

然后推送到远程存储库

git push --force origin <branch>

最新更新