git 将本地(?)分支的更改合并到另一个本地分支

git merge changes from a local(?) branch to another local branch

我有两个分支,我关心 brandon-gce 和 brandon/GCE_startsript。 brandon-gce 是几周前的一个旧分支,上面有一些我需要但从未合并到上游的文件。

我想将 brandon-gce 上的所有 terraform 更改拉入我的新 brandon/GCE_startsript 分支。我敢肯定这很简单,关于如何做到这一点有数百种解释,但我不熟悉 git 并且害怕弄乱我不知道如何修复。

➜  terraform git:(brandon-gce) git diff --name-status brandon-gce..brandon/GCE_startsript | grep terraform
M    /terraform/environments/food/gcp-us-east4/pods.tf
M    /terraform/environments/food/gcp-us-east4/variables.tf
M    /terraform/environments/staging/gcp-us-east4/pods.tf
M    /terraform/environments/staging/gcp-us-east4/variables.tf
M    /terraform/modules/gcp-region/firewall.tf
D    /terraform/modules/screencast-gcp-pod/.gateway.tf.swp
D    /terraform/modules/screencast-gcp-pod/blargh.tf
M    /terraform/modules/screencast-gcp-pod/variables.tf

我在想我应该做这样的事情。是吗?

➜  terraform git:(brandon-gce) git rev-parse HEAD
7561c4083a742a6949cba397af964bff2a92765e
➜  terraform git:(brandon/GCE_startsript) git cherry-pick 7561c4083a742a6949cba397af964bff2a92765e

来自新分支

git merge brandon-gce