ฉันไม่ใช่อาจารย์ git แต่ฉันได้ทำงานกับมันมาระยะหนึ่งแล้วด้วยโครงการที่แตกต่างกันหลายโครงการ ในแต่ละโครงการฉันจะเสมอgit clone [repository]และจากจุดนั้นสามารถทำได้git pullตราบใดที่ฉันไม่มีการเปลี่ยนแปลงที่โดดเด่นแน่นอน
เมื่อเร็ว ๆ git checkout 4f82a29นี้ผมต้องย้อนกลับไปยังสาขาก่อนหน้านี้และทำเช่นนั้นด้วย เมื่อฉันพร้อมที่จะดึงอีกครั้งฉันก็พบว่าฉันต้องกลับไปที่กิ่ง ตอนนี้ฉันไม่สามารถดึงโดยใช้เส้นตรงได้git pullแต่ต้องระบุgit pull origin masterซึ่งน่ารำคาญและบอกกับฉันว่าฉันไม่เข้าใจสิ่งที่เกิดขึ้น
มีการเปลี่ยนแปลงอะไรที่ไม่อนุญาตให้ฉันทำแบบตรงgit pullโดยไม่ต้องระบุตัวตนต้นแบบและฉันจะเปลี่ยนกลับได้อย่างไร
UPDATE:
-bash-3.1$ cat config
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[branch "master"]
[remote "origin"]
url = git@github.com:user/project.git
fetch = refs/heads/*:refs/remotes/origin/*
อัปเดต 2: เพื่อความชัดเจนฉันเข้าใจว่าวิธีดั้งเดิมของฉันอาจไม่ถูกต้อง แต่ฉันต้องแก้ไข repo นี้เพื่อที่ฉันจะสามารถใช้งานได้git pullอีกครั้ง ปัจจุบัน git pull ให้ผลลัพธ์เป็น:
-bash-3.1$ 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
name which branch you want to merge on the command line and
try again (e.g. 'git pull ').
See git-pull(1) for details on the refspec.
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 pullที่สาขาที่ผสานและการทำงานอย่างถูกต้อง แต่git pullไม่ทำงานเท่าที่จะทำได้ git checkoutแต่เดิมก่อนที่จะฉัน