2014-01-06 31 views
0

我正在製作分叉式回購的本地副本。Git rebase upstream/master - 請在您更改分支之前提交您的更改或存儲它們

在我推送更改之前,我想確保我的副本與上游/主站保持同步。這是我做過什麼:

$ git fetch upstream 

$ git add /webroot/wp-content/plugins/cbp_recycling 

$ git commit -m "cbp_recycling added" 
[develop 36411f0] cbp-recycling added 
42 files changed, 830 insertions(+) 

$ git status 
# On branch develop 
# Your branch is ahead of 'origin/develop' by 1 commit. 
# 
# Untracked files: 
# (use "git add <file>..." to include in what will be committed) 
# 
#  logs/ 
#  webroot/.htaccess 
#  webroot/wp-content/plugins/CBP_Promobox/ 
nothing added to commit but untracked files present (use "git add" to track) 


$ git rebase upstream/master 
First, rewinding head to replay your work on top of it... 
error: Your local changes to the following files would be overwritten by checkout: 
     webroot/wp-config.php 
Please, commit your changes or stash them before you can switch branches. 
Aborting 
could not detach HEAD 

的wp-config.php文件沒有改變,因爲我已經添加了我的數據庫憑據,但當時爲什麼不上市的時候我跑git的狀態?

我的.gitignore文件:

.idea 
.vagrant 
.DS_Store 

什麼我做錯了,如何更新我的本地副本上游/大師。

+0

也許還有'。'webroot /'中排除'wp-config.php'的gitignore文件? – rednaw

+0

'git fetch'只能從上游下載對象和引用。你也想'git merge upstream/master'。 –

+0

沒有.gitignore在webroot/ –

回答

0

Git是告訴你,你還需要添加的目錄列表:

logs/ 
    webroot/.htaccess 
    webroot/wp-content/plugins/CBP_Promobox/ 

這取決於你的分支的根目錄中。

現在你可以待辦事項這樣的: 轉到根dirand類型:

git add -p 

,或者如果你想添加的所有

git add . 

選擇要添加

鍵入後wath

git commit 

和自動啓動納米類型你提交的信息

現在

推它

git push 

如果是最前一頁時間推

git push -u origin/develop 

在你的分支工作無論如何發展,爲什麼你改變主人?

進入更改開發高手,之後提交和推搡,你必須轉到分支主和類型

git pull 
    git merge develop 

希望這有助於你 混帳合併

+0

我不想添加這些文件夾。我將添加到.gitignore,但我的問題是wp-config.php,正如我所提到的,我更新了。那個目錄中的 –

+0

是wp-config.php? 你可以只添加這個變化與git add -p – archetipo

+0

我想我找到了問題的根源。 webroot/wp-config.php列在.git/info/exclude中。我會在修復後發佈答案 –

0

我的錯。我檢查了.git \ info \ exclude文件,並在那裏找到了webroot/wp-config.php。我還記得現在在那裏添加它。

但它沒有解決問題。 Git的狀態仍沒有返回,所以我落得這樣做:

$ git checkout webroot/wp-config.php 

$ git merge upstream/master 

手動更新的wp-config.php文件,以確保一切正常,並推動改變回購。

你使用git和config文件的方式是什麼?