现在的位置: 首页 > 综合 > 正文

.git/config文件

2013年11月07日 ⁄ 综合 ⁄ 共 654字 ⁄ 字号 评论关闭

1. 如果只在本地创建仓库,那么.git/config文件只有这么几行:

[core]
           repositoryformatversion = 0
           filemode  = true
           bare = false
           logalrefupdates = true

2.如果这个仓库通过git remote add origin git@git_i5:nexus/android_4_0.git 添加到远程服务器git_i5的仓库,那么这个文件会多出下面几行:

[remote "origin"]
            fetch = +refs/heads/*:refs/remotes/origin/*
            url = git@git_i5:nexus/android_4_0.git


3.然而,在这种情况,如果本地仓库做了改动,调用了git commit 之后,再用git status,报出来的信息为:

# On branch master
nothing to commit (working directory clean)

这样是不符合我们的希望的,因为这样就不能提示本地仓库和远程仓库之间会有提交差别了,所以,在这个文件里加上:

[branch "master"]
            remote = origin
            merge = refs/heads/master


这样,再次调用git status,会显示

# On branch master
# Your branch is ahead of 'origin/master' by1 commit
#
nothing to commit (working directory clean)

来提示你本地仓库和远程仓库是相差了一个commit的。

抱歉!评论已关闭.