【发布时间】:2016-05-05 07:00:33
【问题描述】:
我来自一个反复无常的背景,我可以更新到某个提交,这就是我的代码完全一样的地方,任何更改都会被删除。 我试图在 git 中做同样的事情但没有成功,这就是我所做的:
Naguib@Naguib MINGW64 /d/.Net omitted/omitted (deploy)
$ git checkout staging
Switched to branch 'staging'
Your branch is up-to-date with 'origin/staging'.
Naguib@Naguib MINGW64 /d/.Net omitted/omitted (staging)
$ git fetch
Password for 'https://naguibihab@github.com':
Naguib@Naguib MINGW64 /d/.Net omitted/omitted (staging)
$ git merge preprod
Already up-to-date.
此时我意识到我想以相反的方式合并,检查 preprod 并将 staging 合并到其中,但首先我想确保 preprod 工作正常。 所以我:
Naguib@Naguib MINGW64 /d/.Net omitted/omitted (staging)
$ git checkout preprod
Switched to branch 'preprod'
Your branch is ahead of 'origin/preprod' by 68 commits.
(use "git push" to publish your local commits)
Naguib@Naguib MINGW64 /d/.Net omitted/omitted (preprod)
$ git fetch
Password for 'https://naguibihab@github.com':
remote: Counting objects: 4, done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 4 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (4/4), done.
From https://github.com/BlueChilli/omitted
55d05f4..2381261 staging -> origin/staging
Naguib@Naguib MINGW64 /d/.Net omitted/omitted (preprod)
$ git status
On branch preprod
Your branch is ahead of 'origin/preprod' by 68 commits.
(use "git push" to publish your local commits)
nothing to commit, working directory clean
Naguib@Naguib MINGW64 /d/.Net omitted/omitted (preprod)
$ git pull
Password for 'https://naguibihab@github.com':
Already up-to-date.
Naguib@Naguib MINGW64 /d/.Net omitted/omitted (preprod)
$ git status
On branch preprod
Your branch is ahead of 'origin/preprod' by 68 commits.
(use "git push" to publish your local commits)
nothing to commit, working directory clean
Naguib@Naguib MINGW64 /d/.Net omitted/omitted (preprod)
$ git reset --hard
HEAD is now at 55d05f4 merge from staff_filter
Naguib@Naguib MINGW64 /d/.Net omitted/omitted (preprod)
$ git status
On branch preprod
Your branch is ahead of 'origin/preprod' by 68 commits.
(use "git push" to publish your local commits)
nothing to commit, working directory clean
我希望 preprod 与 origin/preprod 保持同步,以便在该远程分支中拥有完全相同的代码。我该怎么做?
【问题讨论】:
标签: git