2014-10-12 84 views

回答

3

Git只發現其他人在您詢問是否有更改或您嘗試更改時已更改存儲庫。總之:不。儘管如此,可以與git以外的團隊進行溝通。建議,甚至。

0

Git是DVCS(其中D表示分散)。沒有其他協作者的知識庫的本地副本。

我假定你使用的是中央遠程(git服務器),並且你的意思是當你從另一個協作者推送他們的變更後從你的遠程服務器進行隱式合併時,你的結果會導致合併衝突。

在下面的測試中,remote是你的中央倉庫(它可能是一個URL,這裏只是一個本地目錄,但git不關心),foo是你的本地副本,bar是你的同事的。

mkdir gitTests 
cd gitTests 
#Create our remote (server) 
git init --bare remote 

#Create a new repo in directory foo 
git init foo 
cd foo 
echo 'a' > a 
git add a 
git commit -m 'First commit' 
#Set the remote as our central repo and push to it 
git push --set-upstream ../remote master 

#Create our colleague's repo from the remote 
git clone ../remote ../bar 
#Colleague makes a commit, pushes to remote 
cd ../bar 
echo 'b' >> a 
git commit a -m 'Colleague commit' 
git push 

#We work on the same file, creating a merge conflict 
cd ../foo 
echo 'c' >> a 
git commit a -m 'Our conflicting commit' 
git push 
#We get an error, because our push is non fast-forward, we need to pull before 
git pull 
#Here, we get a local merge conflict 

正如你可能已經理解的那樣,你試圖推動只有一個衝突。那時,只有你的同事在遙控器上提交,你可以打電話給你的辦公桌一起解決衝突。一旦完成,你可以推動,他們拉動,問題就解決了。

+0

謝謝你的回答,我需要一點時間來完成它 – rustystylus 2014-10-12 03:48:52