2015-04-17 65 views
0

我有兩個git回購。一個包含一個我修改但沒有提交的文件,另一個文件不包含任何文件(它是一個裸露的回購)。我將如何將這些變更從修改後的版本推到裸回購版?我對git和unix相當陌生,所以任何幫助將不勝感激!在git中推送更改爲裸回購

[email protected]:~/cs265/lab3-git$ git status 
On branch master 
Changes to be committed: 
    (use "git reset HEAD <file>..." to unstage) 

     new file: lab3 

Changes not staged for commit: 
    (use "git add <file>..." to update what will be committed) 
    (use "git checkout -- <file>..." to discard changes in working directory) 

     modified: lab3 
+0

推而改變? 「承諾變更」以及「不承諾承諾」?或者只是前者? – Kaz

+1

是從裸回購克隆本地回購? (本地回購知道裸回購?) – Kaz

+2

如果你有一個誤解,「裸回購」並不意味着*「不包含任何文件」*,但:*「包含git對象的數據庫,沒有工作樹,元文件在repo的根目錄下,而不是'.git'子目錄。「*遠程倉庫是否裸露在這裏並不重要。推動通常是做裸露的回購。如果推送到* non * -bare repo,那麼可能需要特殊處理,如果推送影響在該repo中檢出的分支。 – Kaz

回答

0

提交

首先,你需要提交在本地資源庫的更改。

$ git add lab3 
$ git commit 

http://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository

添加遠程

接下來,您應該添加遠程倉庫作爲遠程到本地存儲庫。

$ git remote add remote-name http://remote-url.edu 

http://git-scm.com/book/en/v2/Git-Basics-Working-with-Remotes

最後,你應該把你的承諾你的遙控器。

$ git push remote-name branch-name 

http://git-scm.com/docs/git-push