Bằng cách chỉ định $ git push
không có tham số kho lưu trữ, theo mặc định nó sẽ đẩy chi nhánh hiện tại vào nhánh từ xa theo dõi.
Khi bạn chỉ định $ git push origin
, bạn đang đẩy rõ ràng các thay đổi của mình vào kho lưu trữ từ xa origin
.
Đối với câu hỏi của bạn về việc gửi "2x" lên thượng nguồn, đó không phải là hành vi. Nó sẽ đẩy các thay đổi một lần duy nhất đến kho lưu trữ ngược dòng.
Documentation on git-push
Khi bạn làm một $ git push
không có tham số, Git là thực sự khá dài dòng với những hành động đó sẽ đưa:
warning: push.default is unset; its implicit value has changed in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the traditional behavior, use:
git config --global push.default matching
To squelch this message and adopt the new behavior now, use:
git config --global push.default simple
When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.
Since Git 2.0, Git defaults to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.
See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)
Nguồn
2015-09-11 13:42:32
Ý anh là gì, nó là "gửi nó 2x" vào Thượng nguồn? Bạn đang nhìn cái gì vậy? –