2017-04-20 82 views
1

我需要解釋一下Git,這對我來說有點新鮮。Git結賬和遠程跟蹤誤解

我來自老同學SVN,每個人都快點承諾遠程倉庫來你們不知道衝突....這一次完成:)。

嗯,是我用git三個命令:)

C:\webs\carrefour-france\crf-fra>git checkout -b fflbranche origin/dev-17.5-tma 
Switched to a new branch 'fflbranche' 
Branch fflbranche set up to track remote branch dev-17.5-tma from origin. 

C:\webs\carrefour-france\crf-fra>git status 
On branch fflbranche 
Your branch is up-to-date with 'origin/dev-17.5-tma'. 
Untracked files: 
    (use "git add <file>..." to include in what will be committed) 

     crf-fra-core/src/main/documentation/diagramme.vpp.bak_000f 
     crf-fra-core/src/main/documentation/diagramme.vpp.vbak 
     crf-fra-core/src/main/documentation/diagramme.vux 
     crf-fra-eshop-fo/src/main/documentation/diagrammes.vpp.bak_000f 
     crf-fra-eshop-fo/src/main/documentation/diagrammes.vpp.vbak 
     crf-fra-eshop-fo/src/main/documentation/diagrammes.vux 
     src/main/documentation/Architecture.vpp.bak_000f 
     src/main/documentation/Architecture.vpp.vbak 
     src/main/documentation/Architecture.vux 

nothing added to commit but untracked files present (use "git add" to track) 

C:\webs\carrefour-france\crf-fra> 

2)

C:\webs\carrefour-france\crf-fra>git branch --list 
    dev-17.5 
    dev-17.5-art04 
* fflbranche 
    master 
    origin/dev-17.5 

C:\webs\carrefour-france\crf-fra> 

3)

C:\webs\carrefour-france\crf-fra>git remote show origin 
Username for 'http://kazan.priv.atos.fr': a665145 
Password for 'http://[email protected]': 
* remote origin 
    Fetch URL: http://kazan.priv.atos.fr/git/crf-fra 
    Push URL: http://kazan.priv.atos.fr/git/crf-fra 
    HEAD branch: master 
    Remote branches: 
    17.2-eligibilite   tracked 
    dev-15.3.2-optimAdmin  tracked 
    dev-16.0.1     tracked 
    dev-16.1-old    tracked 
    ...(much more) 
    stable-17.3-monitoringSF tracked 
    stable-17.3.1    tracked 
    stable-CONF-ENV   tracked 
    tmp-trunk     tracked 
    Local branches configured for 'git pull': 
    dev-17.5  merges with remote dev-17.5 
    dev-17.5-art04 merges with remote dev-17.5-art04 
    fflbranche  merges with remote dev-17.5-tma 
    master   merges with remote master 
    Local refs configured for 'git push': 
    dev-17.5  pushes to dev-17.5  (local out of date) 
    dev-17.5-art04 pushes to dev-17.5-art04 (up to date) 
    master   pushes to master   (local out of date) 

我的問題是:

爲什麼在上次輸出時,在「爲git push配置的本地引用」:「部分它沒有出現」fflbranche「。這是否意味着如果我在本地分支上修改文件,我無法將其推送到遠程跟蹤分支?

謝謝你的燈!

回答

0

爲什麼在最後輸出的,在「配置‘混帳推’本地裁判:」部分沒有出現「fflbranche」

我想你還沒有被推到遠程卻又如此,混帳沒有保存它。你顯然可以推動遠離fflbranche分支。

$ git checkout fflbranche 
// do changes & commit 

$ git push -u origin fflbranche  
# -u = --set-upstream tells git to remember the parameters, so that next time you can simply run 'git push' 

$ git remote show origin 
+0

非常感謝。你說得對,我還沒有推動。 –

0

Git分支是懶惰的,git不會創建本地分支,除非您命令它這樣做。

通常情況下,一個git checkout將初始化與遠程狀態的分支,並設置跟蹤狀態正常。

如果你想推一個分支不跟蹤(這往往是新的分支),設置產地也適用:

git push --set-upstream origin "$(git-branch-current 2> /dev/null)" 

你有多個被按壓遙控器,讓你還想來取代origin你想要的遙控器。