如果我执行
git checkout -b samename origin/samename
然后跟踪似乎正常工作。如果我进行后续提交,我就可以执行
git push
我提交的代码已经成功地通过git推送到了远端仓库。
但是,如果我执行以下命令:
git checkout -b diffname origin/samename
如果跟踪不起作用,尽管在《Pro Git》书中有这一节:
$ git checkout -b sf origin/serverfix
Branch sf set up to track remote branch refs/remotes/origin/serverfix.
Switched to a new branch "sf"
Now, your local branch sf will automatically push to and pull from origin/serverfix
Git push命令提示“Everything up to date”是什么意思?
我正在mac os x上运行git 1.7.1版本。
以下是整个实验的步骤,供有兴趣尝试的人参考:
szbwood-mbp15:proj4_local bwood$ vi file1
szbwood-mbp15:proj4_local bwood$ git add file1
szbwood-mbp15:proj4_local bwood$ git commit -m"Created file 1"
[master (root-commit) 5d50289] Created file 1
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 file1
szbwood-mbp15:proj4_local bwood$ git push origin master:samename
Counting objects: 3, done.
Writing objects: 100% (3/3), 225 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
To /Users/bwood/work/gitplay/proj4_remote.git
* [new branch] master -> samename
szbwood-mbp15:proj4_local bwood$ git checkout -b samename origin/samename
Branch samename set up to track remote branch samename from origin.
Switched to a new branch 'samename'
szbwood-mbp15:proj4_local bwood$ vi file1
szbwood-mbp15:proj4_local bwood$ git commit -a
[samename a7af908] ..
1 files changed, 1 insertions(+), 0 deletions(-)
szbwood-mbp15:proj4_local bwood$ git push
Counting objects: 5, done.
Writing objects: 100% (3/3), 251 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
Unpacking objects: 100% (3/3), done.
To /Users/bwood/work/gitplay/proj4_remote.git
5d50289..a7af908 samename -> samename
szbwood-mbp15:proj4_local bwood$ git checkout -b diffname origin/samename
Branch diffname set up to track remote branch samename from origin.
Switched to a new branch 'diffname'
szbwood-mbp15:proj4_local bwood$ vi file1
szbwood-mbp15:proj4_local bwood$ git commit -a
[diffname c5bbec1] ..
1 files changed, 1 insertions(+), 0 deletions(-)
szbwood-mbp15:proj4_local bwood$ git push
Everything up-to-date
奇怪的是,配置文件看起来很正常。
[branch "samename"]
remote = origin
merge = refs/heads/samename
[branch "diffname"]
remote = origin
merge = refs/heads/samename