因工作需要 所以要抓同事開出來的 branch
所以找一下命令 如 下 這樣就可以抓到遠端的
git checkout --track -b new origin/new
另外若PUSH遇到問題
git push
結果有Warning如下
warning: You did not specify any refspecs to push, and the current remote
warning: has not configured any push refspecs. The default action in this
warning: case is to push all matching refspecs, that is, all branches
warning: that exist both locally and remotely will be updated. This may
warning: not necessarily be what you want to happen.
warning:
warning: You can specify what action you want to take in this case, and
warning: avoid seeing this message again, by configuring 'push.default' to:
warning: 'nothing' : Do not push anything
warning: 'matching' : Push all matching branches (default)
warning: 'tracking' : Push the current branch to whatever it is tracking
warning: 'current' : Push the current branch
Counting objects: 5, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 386 bytes, done.
Total 3 (delta 0), reused 0 (delta 0)
To git@192.168.168.70:gitosis-admin.git
1cfd916..4f2becf master -> master
我找到的解決方式是
git config --add push.default current
原始資料如下
http://ihower.tw/blog/archives/2620
http://tw.myblog.yahoo.com/stevegigijoe/article?mid=218
1.其他人push過後就不能push了
gigijoe@gigijoe-desktop:~/DSPG8181$ git push
To git@localhost:DSPG8181.git
! [rejected] HEAD -> master (non-fast forward)
error: failed to push some refs to 'git@localhost:DSPG8181.git'
也不能pull了
gigijoe@gigijoe-desktop:~/DSPG8181$ git pull
You asked me to pull without telling me which branch you
want to merge with, and 'branch.master.merge' in
your configuration file does not tell me either. Please
specify which branch you want to merge on the command line and
try again (e.g. 'git pull ').
See git-pull(1) for details.
If you often merge with the same branch, you may want to
configure the following variables in your configuration
file:
branch.master.remote =
branch.master.merge =
remote. .url =
remote. .fetch =
See git-config(1) for details.
git config branch.master.remote origin
git config branch.master.merge refs/heads/mastergit checkout master
git reflog
git pull
git push
另一個解法(沒試過)git pull origin master
留言列表