首页 > 代码库 > Linux git 多人协助开发实战
Linux git 多人协助开发实战
git 服务器搭建 创建公钥,准备免密登录 初始化一个版本库 git clone git客户端 查看git状态 创建一个文件 添加到暂缓区 提交到版本库 查看git日志 checkout 从缓存区恢复文件到工作区 reset 版本区恢复到缓存区 查看git日志 reset --hard 工作区,缓存区被版本库重置 查看工作区与缓存区的差异 查看缓存区与版本库的差异 查看工作区与版本库的差异 演示git状态,精简状态 删除版本库的文件 从版本库恢复文件 查看文件提交的历史信息,便于bug追踪 branch 分支创建 branch 分支切换 分支删除 强制删除分支 先删除本地分支,再删除远程版本库对应的分支 [merge分支合并],排版可能会冲突 版本标记 版本回退 [github]联网操作 项目创建 推送到远程服务器: 多人协助开发 免密配置
git服务器搭建
[在git服务器的操作]安装git服务,创建git用户
sudo apt-get install git sudo adduser git
[在git客户端的操作],创建公钥,准备免密登录
chunli~魂斗罗 ssh-keygen -t rsa -P ‘‘ cat ~/.ssh/id_rsa.pub ssh-rsa xxxxxxxxxxxxxxxxxxxxxxxx8********************
[在git服务器的操作]把客户端的公钥传到git服务器
su - git Password: git git@ubuntu14:~$ mkdir .ssh git@ubuntu14:~$ cd .ssh/ git@ubuntu14:~/.ssh$ touch authorized_keys git@ubuntu14:~/.ssh$ echo "ssh-rsa xxxxxxxxxxxxxxxxxxxxxxxx8********************" >> authorized_keys
[在git客户端的操作],测试,出现登录提示
ssh git@11.11.11.17
[在git服务器的操作],初始化一个版本库
git@ubuntu14:~$ git init --bare my_git/ Initialized empty Git repository in /home/git/my_git/ git@ubuntu14:~$ echo $? 0 git@ubuntu14:~$ ll my_git/ total 40 drwxrwxr-x 7 git git 4096 Sep 24 12:07 ./ drwxr-xr-x 5 git git 4096 Sep 24 12:06 ../ drwxrwxr-x 2 git git 4096 Sep 24 12:07 branches/ -rw-rw-r-- 1 git git 66 Sep 24 12:07 config -rw-rw-r-- 1 git git 73 Sep 24 12:07 description -rw-rw-r-- 1 git git 23 Sep 24 12:07 HEAD drwxrwxr-x 2 git git 4096 Sep 24 12:07 hooks/ drwxrwxr-x 2 git git 4096 Sep 24 12:07 info/ drwxrwxr-x 4 git git 4096 Sep 24 12:07 objects/ drwxrwxr-x 4 git git 4096 Sep 24 12:07 refs/ git@ubuntu14:~$
[在git客户端的操作],git clone
chunli~魂斗罗 git clone git@11.11.11.17:~/my_git Cloning into ‘my_git‘... warning: You appear to have cloned an empty repository. Checking connectivity... done.
git客户端常用操作
查看git状态
chunli~魂斗罗 cd my_git/ chunli~魂斗罗 git status On branch master Initial commit nothing to commit (create/copy files and use "git add" to track)
手动创建一个文件,再查看status
chunli~魂斗罗 vim main.c chunli~魂斗罗 cat main.c #include <stdio.h> int main() { printf("Hello World!\n"); return 0; } chunli~魂斗罗 chunli~魂斗罗 git status On branch master Initial commit Untracked files: (use "git add <file>..." to include in what will be committed) main.c nothing added to commit but untracked files present (use "git add" to track)
添加到暂缓区
chunli~魂斗罗 git add main.c
提交到版本库
chunli~魂斗罗~/work/my_git$ git commit -m "wrote a new file" *** Please tell me who you are. Run git config --global user.email "you@example.com" git config --global user.name "Your Name" to set your account‘s default identity. Omit --global to set the identity only in this repository. fatal: unable to auto-detect email address (got ‘chunli@ubuntu14.(none)‘) chunli~魂斗罗~/work/my_git$ 解决办法, chunli~魂斗罗~/work/my_git$ git config --global user.email "li_chunli@mail.com" chunli~魂斗罗~/work/my_git$ git config --global user.name "chunli" [提交文件]可以提交成功了 chunli~魂斗罗~/work/my_git$ git commit -m "wrote a new file" [master (root-commit) a5f6b95] wrote a new file 1 file changed, 6 insertions(+) create mode 100644 main.c
查看git状态
chunli~魂斗罗~/work/my_git$ git status On branch master Your branch is based on ‘origin/master‘, but the upstream is gone. (use "git branch --unset-upstream" to fixup) nothing to commit, working directory clean chunli~魂斗罗~/work/my_git$
[查看git日志]
chunli~魂斗罗~/work/my_git$ git log commit a5f6b9506e18057ee95e98852c56a31d5280a433 Author: chunli <li_chunli@mail.com> Date: Sat Sep 24 13:28:06 2016 +0800 wrote a new file chunli~魂斗罗~/work/my_git$
[checkout 从缓存区恢复文件到工作区]
chunli~魂斗罗~/work/my_git$ vim main.c chunli~魂斗罗~/work/my_git$ cat main.c #include <stdio.h> int main() { //哈哈这是我的修改 printf("Hello World!\n"); return 0; } 开始回退: chunli~魂斗罗~/work/my_git$ git checkout a5f6 main.c 跟上commit的掐前几位就可以,commit a5f6b9506e18057ee95e98852c56a31d5280a433 chunli~魂斗罗~/work/my_git$ cat main.c #include <stdio.h> int main() { printf("Hello World!\n"); return 0; } chunli~魂斗罗~/work/my_git$
reset 版本区恢复到缓存区
2,环境:工作区,缓存区,版本区一致: chunli~魂斗罗~/work/my_git$ git status -s 3,修改工作区的文件: chunli~魂斗罗~/work/my_git$ vim main.c 4,工作区提交到缓存区 chunli~魂斗罗~/work/my_git$ git add main.c 5,查看版本区与缓存区的差异: chunli~魂斗罗~/work/my_git$ git diff --cached main.c diff --git a/main.c b/main.c index 6eea5e1..1794ffc 100644 --- a/main.c +++ b/main.c @@ -1,7 +1,6 @@ #include <stdio.h> int main() { - //我的注释 printf("Hello World!"); return 0; } chunli~魂斗罗~/work/my_git$ chunli~魂斗罗~/work/my_git$ git status -s M main.c chunli~魂斗罗~/work/my_git$ 6,将版本区恢复到缓存区: chunli~魂斗罗~/work/my_git$ git reset main.c Unstaged changes after reset: M main.c chunli~魂斗罗~/work/my_git$ git status -s M main.c chunli~魂斗罗~/work/my_git$ chunli~魂斗罗~/work/my_git$ git checkout main.c chunli~魂斗罗~/work/my_git$ git status -s chunli~魂斗罗~/work/my_git$ 版本再一次恢复到一致
reset --hard 工作区,缓存区被版本库重置
1,为了演示,我把文件直接删除 chunli~魂斗罗~/work/my_git$ rm main.c chunli~魂斗罗~/work/my_git$ cat main.c cat: main.c: No such file or directory 2,开始重置 chunli~魂斗罗~/work/my_git$ git reset --hard HEAD HEAD is now at 682d029 第三次update 3,测试,文件果然回来了 chunli~魂斗罗~/work/my_git$ cat main.c #include <stdio.h> int main() { //我的注释 printf("Hello World!"); return 0; } chunli~魂斗罗~/work/my_git$
[查看工作区与缓存区的差异]
chunli~魂斗罗~/work/my_git$ git diff 当前没有差异: 那我就把文件修改一下: chunli~魂斗罗~/work/my_git$ vim main.c chunli~魂斗罗~/work/my_git$ cat main.c #include <stdio.h> int main() { //我的注释 printf("Hello World!"); } 再看看diff的描述,彩色的,多一行,少一行,显示的很清楚 chunli~魂斗罗~/work/my_git$ git diff diff --git a/main.c b/main.c index 89b92aa..1d24e22 100644 --- a/main.c +++ b/main.c @@ -1,6 +1,6 @@ #include <stdio.h> int main() { - printf("Hello World!\n"); - return 0; + //我的注释 + printf("Hello World!"); } chunli~魂斗罗~/work/my_git$
查看缓存区与版本库的差异
1,提交任务到暂缓区 chunli~魂斗罗~/work/my_git$ git add main.c chunli~魂斗罗~/work/my_git$ git diff --cached diff --git a/main.c b/main.c index 89b92aa..1d24e22 100644 --- a/main.c +++ b/main.c @@ -1,6 +1,6 @@ #include <stdio.h> int main() { - printf("Hello World!\n"); - return 0; + //我的注释 + printf("Hello World!"); } chunli~魂斗罗~/work/my_git$
[查看工作区与版本库的差异]
chunli~魂斗罗~/work/my_git$ git diff HEAD diff --git a/main.c b/main.c index 89b92aa..1d24e22 100644 --- a/main.c +++ b/main.c @@ -1,6 +1,6 @@ #include <stdio.h> int main() { - printf("Hello World!\n"); - return 0; + //我的注释 + printf("Hello World!"); } chunli~魂斗罗~/work/my_git$
第二次提交
1,提交 chunli~魂斗罗~/work/my_git$ git commit -m "第二次提交" main.c [detached HEAD cc0c421] 第二次提交 1 file changed, 2 insertions(+), 2 deletions(-)
2,查看git状态
chunli~魂斗罗~/work/my_git$ git status HEAD detached from a5f6b95 nothing to commit, working directory clean
3,查看git日志
chunli~魂斗罗~/work/my_git$ git log commit cc0c4219374ed151c4d91cc8fcf9a07fa2745003 Author: chunli <li_chunli@mail.com> Date: Sat Sep 24 13:45:38 2016 +0800 第二次提交 commit a5f6b9506e18057ee95e98852c56a31d5280a433 Author: chunli <li_chunli@mail.com> Date: Sat Sep 24 13:28:06 2016 +0800 wrote a new file chunli~魂斗罗~/work/my_git$
[演示git状态,精简状态]
1,把本地文件稍作修改 chunli~魂斗罗~/work/my_git$ vim main.c chunli~魂斗罗~/work/my_git$ cat main.c #include <stdio.h> int main() { //我的注释 printf("Hello World!"); return 0; } chunli~魂斗罗~/work/my_git$ 2,查看git状态 chunli~魂斗罗~/work/my_git$ git status HEAD detached from a5f6b95 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: main.c no changes added to commit (use "git add" and/or "git commit -a") 3,精简显示git状态,注意M左右的空格 chunli~魂斗罗~/work/my_git$ git status -s M main.c 4,把任务推到暂缓区 chunli~魂斗罗~/work/my_git$ git add main.c 5,精简显示git状态,注意M左右的空格 chunli~魂斗罗~/work/my_git$ git status -s M main.c 6,查看git状态 chunli~魂斗罗~/work/my_git$ git status HEAD detached from a5f6b95 Changes to be committed: (use "git reset HEAD <file>..." to unstage) modified: main.c chunli~魂斗罗~/work/my_git$ 7,提交任务到版本区 chunli~魂斗罗~/work/my_git$ git commit -m "第三次update" main.c [detached HEAD 682d029] 第三次update 1 file changed, 1 insertion(+) 8,查看git状态 chunli~魂斗罗~/work/my_git$ git status HEAD detached from a5f6b95 nothing to commit, working directory clean 9,精简显示git状态 chunli~魂斗罗~/work/my_git$ git status -s chunli~魂斗罗~/work/my_git$
[删除版本库的文件]
chunli~魂斗罗~/work/my_git$ git rm main.c rm ‘main.c‘ chunli~魂斗罗~/work/my_git$ ls -l total 0 chunli~魂斗罗~/work/my_git$ git commit -m "rm main.c" [detached HEAD e828b0a] rm main.c 1 file changed, 7 deletions(-) delete mode 100644 main.c chunli~魂斗罗~/work/my_git$ git status -s chunli~魂斗罗~/work/my_git$ ll total 0 chunli~魂斗罗~/work/my_git$ chunli~魂斗罗~/work/my_git$ git log commit e828b0ae6a6de63f705d6626177e3c4a358c9b9c Author: chunli <li_chunli@mail.com> Date: Sat Sep 24 14:18:48 2016 +0800 rm main.c
[查看文件提交的历史信息,便于bug追踪]
1,源文件 chunli~魂斗罗~/work/my_git$ cat main.c #include <stdio.h> int main() { printf("Hello World!"); return 0; } chunli~魂斗罗~/work/my_git$ 2,添加到缓存区 chunli~魂斗罗~/work/my_git$ git add main.c 3,提交 chunli~魂斗罗~/work/my_git$ git commit -m "test 1 blame" [detached HEAD f8b06fe] test 1 blame 1 file changed, 1 insertion(+), 2 deletions(-) 4,查看文件历史,可以看到 printf("Hello World!\n");发生了变动 chunli~魂斗罗~/work/my_git$ git blame main.c 3983d686 (chunli 2016-09-24 14:26:08 +0800 1) #include <stdio.h> 3983d686 (chunli 2016-09-24 14:26:08 +0800 2) int main() 3983d686 (chunli 2016-09-24 14:26:08 +0800 3) { f8b06fe0 (chunli 2016-09-24 14:28:09 +0800 4) printf("Hello World!\n"); 3983d686 (chunli 2016-09-24 14:26:08 +0800 5) return 0; 3983d686 (chunli 2016-09-24 14:26:08 +0800 6) } chunli~魂斗罗~/work/my_git$
[branch 分支创建]
1,查看分支 chunli~魂斗罗~/work/my_git$ git branch * (detached from a5f6b95) master chunli~魂斗罗~/work/my_git$ 2,创建分支: chunli~魂斗罗~/work/my_git$ git checkout -b dev Switched to a new branch ‘dev‘ chunli~魂斗罗~/work/my_git$ git branch * dev master chunli~魂斗罗~/work/my_git$ 3,修改代码并保存: chunli~魂斗罗~/work/my_git$ echo ‘// git checkout -b dev ‘ >> main.c chunli~魂斗罗~/work/my_git$ git add main.c chunli~魂斗罗~/work/my_git$ git commit -m "git checkout -b dev" [dev 670315e] git checkout -b dev 1 file changed, 1 insertion(+) chunli~魂斗罗~/work/my_git$ cat main.c #include <stdio.h> int main() { printf("Hello World!\n"); return 0; } // git checkout -b dev chunli~魂斗罗~/work/my_git$
[branch 分支切换]
1,查看当前处于哪个分支? chunli~魂斗罗~/work/my_git$ git branch * dev master 2,分支切换 chunli~魂斗罗~/work/my_git$ git checkout master Switched to branch ‘master‘ Your branch is based on ‘origin/master‘, but the upstream is gone. (use "git branch --unset-upstream" to fixup) 3,查看代码状态 chunli~魂斗罗~/work/my_git$ cat main.c #include <stdio.h> int main() { printf("Hello World!\n"); return 0; } chunli~魂斗罗~/work/my_git$
分支删除,如果没有合并,就失败:git branch -d newbranch
强制删除分支:git branch -D newbranch
先删除本地分支,再删除远程版本库对应的分支 git push origin :newbranch
[merge分支合并],排版可能会冲突
1,查看当前所在分支 chunli~魂斗罗~/work/my_git$ git branch dev * master 2,查看当前分支下的源代码 chunli~魂斗罗~/work/my_git$ cat main.c #include <stdio.h> int main() { printf("Hello World!\n"); return 0; } 3,分支合并 chunli~魂斗罗~/work/my_git$ git merge dev Updating a5f6b95..670315e Fast-forward main.c | 1 + 1 file changed, 1 insertion(+) 4,查看合并的结果 chunli~魂斗罗~/work/my_git$ cat main.c #include <stdio.h> int main() { printf("Hello World!\n"); return 0; } // git checkout -b dev chunli~魂斗罗~/work/my_git$ 5,添加->提交 chunli~魂斗罗~/work/my_git$ git add main.c chunli~魂斗罗~/work/my_git$ git commit -m "merge" On branch master Your branch is based on ‘origin/master‘, but the upstream is gone. (use "git branch --unset-upstream" to fixup) nothing to commit, working directory clean 6,我的提交报错了 chunli~魂斗罗~/work/my_git$ git branch --unset-upstream chunli~魂斗罗~/work/my_git$ echo $? 0 chunli~魂斗罗~/work/my_git$ git commit -m "merge" On branch master nothing to commit, working directory clean chunli~魂斗罗~/work/my_git$ git branch dev * master 7,查看git状态: chunli~魂斗罗~/work/my_git$ git status -s chunli~魂斗罗~/work/my_git$
版本标记
chunli~魂斗罗~/work/my_git$ git tag -m "ver1.0" my_hello chunli~魂斗罗~/work/my_git$ git status -s chunli~魂斗罗~/work/my_git$ vim main.c chunli~魂斗罗~/work/my_git$ git add main.c chunli~魂斗罗~/work/my_git$ git commit -m "add main.c" main.c [master 24a704a] add main.c 1 file changed, 1 deletion(-) chunli~魂斗罗~/work/my_git$ chunli~魂斗罗~/work/my_git$ git tag -m "ver2.0" my_hello2.0 chunli~魂斗罗~/work/my_git$ git tag -l my_hello my_hello2.0 chunli~魂斗罗~/work/my_git$ git tag -l -n my_hello ver1.0 my_hello2.0 ver2.0
[版本回退]
1,查看当前版本的代码 chunli~魂斗罗~/work/my_git$ cat main.c #include <stdio.h> int main() { printf("Hello World!\n"); return 0; } 2,版本退回 chunli~魂斗罗~/work/my_git$ git checkout my_hello Note: checking out ‘my_hello‘. You are in ‘detached HEAD‘ state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by performing another checkout. If you want to create a new branch to retain commits you create, you may do so (now or later) by using -b with the checkout command again. Example: git checkout -b new_branch_name HEAD is now at 670315e... git checkout -b dev chunli~魂斗罗~/work/my_git$ echo $? 0 3,查看代码 chunli~魂斗罗~/work/my_git$ cat main.c #include <stdio.h> int main() { printf("Hello World!\n"); return 0; } // git checkout -b dev chunli~魂斗罗~/work/my_git$ 4,查看tag chunli~魂斗罗~/work/my_git$ git tag -l -n1 my_hello ver1.0 my_hello2.0 ver2.0 5,查看分支与tag,我位于tag上,没有在分支上 chunli~魂斗罗~/work/my_git$ git branch * (detached from my_hello) dev master chunli~魂斗罗~/work/my_git$
[github]联网操作
登陆:https://github.com/login
账号:990487026@qq.com
密码:*****Z!`****************
点击有上角的设置按钮,选择[Your profile],出现新的页面
点击右上角的加号图标,选择[New repository]
对应[Repository name]自己填,我写[chunli_dev]
对应[Description (optional)]随便写,我写[chunli C/C++ dev]
Public免费
Private收费
勾选[Initialize this repository with a README]
点击[Create Repository]
可以找到一个连接[https://github.com/990487026/chunli_dev.git]
[从github克隆到本地]
chunli~魂斗罗~$ mkdir github_test chunli~魂斗罗~$ cd github_test chunli~魂斗罗~/github_test$ git clone https://github.com/990487026/chunli_dev chunli~魂斗罗~/github_test$ tree . └── chunli_dev └── README.md 1 directory, 1 file chunli~魂斗罗~/github_test$
修改本地文件
chunli~魂斗罗~/github_test$ cd chunli_dev/ chunli~魂斗罗~/github_test/chunli_dev$ vim README.md chunli~魂斗罗~/github_test/chunli_dev$ git add README.md chunli~魂斗罗~/github_test/chunli_dev$ git commit -m "mod readme" [master 74616c0] mod readme 1 file changed, 1 insertion(+) chunli~魂斗罗~/github_test/chunli_dev$
继续修改:
chunli~魂斗罗~/github_test/chunli_dev$ vim main.c chunli~魂斗罗~/github_test/chunli_dev$ cp main.c a.c chunli~魂斗罗~/github_test/chunli_dev$ cp main.c b.c chunli~魂斗罗~/github_test/chunli_dev$ cp main.c d.c chunli~魂斗罗~/github_test/chunli_dev$ git commit -m "create 3 file" [master d23a982] create 3 file 4 files changed, 24 insertions(+) create mode 100644 a.c create mode 100644 b.c create mode 100644 d.c create mode 100644 main.c chunli~魂斗罗~/github_test/chunli_dev$
推送到远程服务器:
chunli~魂斗罗~/github_test/chunli_dev$ git push -u origin master Username for ‘https://github.com‘: 990487026@qq.com Password for ‘https://990487026@qq.com@github.com‘: Counting objects: 5, done. Writing objects: 100% (3/3), 273 bytes | 0 bytes/s, done. Total 3 (delta 0), reused 0 (delta 0) To https://github.com/990487026/chunli_dev fe6ea24..74616c0 master -> master Branch master set up to track remote branch master from origin. chunli~魂斗罗~/github_test/chunli_dev$ echo $? 0 chunli~魂斗罗~/github_test/chunli_dev$
验证:
浏览器查看:https://github.com/990487026/chunli_dev
可以看到刚修改的readme文件内容
直接在github网页修改代码,把代码 git pull下来
chunli~魂斗罗~/github_test/chunli_dev$ git pull remote: Counting objects: 3, done. remote: Compressing objects: 100% (3/3), done. remote: Total 3 (delta 1), reused 0 (delta 0), pack-reused 0 Unpacking objects: 100% (3/3), done. From https://github.com/990487026/chunli_dev d23a982..74de7b3 master -> origin/master Updating d23a982..74de7b3 Fast-forward a.c | 7 +++++++ 1 file changed, 7 insertions(+) chunli~魂斗罗~/github_test/chunli_dev$ 验证: chunli~魂斗罗~/github_test/chunli_dev$ cat a.c #include <stdio.h> int main() { printf("Hello World\n"); printf("Hello World\n"); printf("Hello World\n"); printf("Hello World\n"); printf("Hello World\n"); printf("Hello World\n"); printf("Hello World\n"); return 0; } chunli~魂斗罗~/github_test/chunli_dev$
多人协助开发,将一个项目添加多人
每个人授权后,都去clone
git clone https://github.com/990487026/chunli_dev
然后各种修改,用各个的账户密码push
添加:git add * 提交:git commit -m "add file" 推送:git push https://github.com/990487026/chunli_dev 每个人输入自己的账户密码 验证:浏览器打开:https://github.com/990487026/chunli_dev 可以看到push的效果
免密配置:
我的主机:
chunli~魂斗罗~$ cat .ssh/id_rsa.pub
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCeQ0+r2Oks+VX2SHBnbtNvm8uX6Vh3T6wCs7n1fjvhcMPjtZj2vWn6SuWsQiXYAglChgxHO4ixEkzjpVPu3nrjx/jmKVAKSqsRmrDrbR5CtJXg0P2YbKqqD1dx5hdGcGM1TNv1C4sBkictyfmpn+4TPZRWAgkvIm3wWgrYy2o0nEdt69z8VUGBLf0tFyn5mHt7w4p4qHeSIDdzTFtjI31ilceNzSz9UCPCbptPAk08ObU5LhPb5EqOjV1QfnmA7ymR2b0Ys9zO/FytvHgwk7uiTvKaFQS/CSlg+a5uNQHCryr1FhyqkmBHDga7R9HkoPLJ5W9LhqAm1kfNy1tk+QEP chunli@ubuntu14
把公钥传到github
把github 项目clone下来:
chunli~魂斗罗~/github_test$ git clone https://github.com/990487026/chunli_dev chunli~魂斗罗~/github_test$ cd chunli_dev/
修改配置文件:
chunli~魂斗罗~/github_test/chunli_dev$ vim .git/config 将:url = https://github.com/990487026/chunli_dev 换:url = git@github.com:990487026/chunli_dev
修改文件,演示免密推送
chunli~魂斗罗~/github_test/chunli_dev$ vim main.c chunli~魂斗罗~/github_test/chunli_dev$ git add * chunli~魂斗罗~/github_test/chunli_dev$ git commit -m "change main.c " chunli~魂斗罗~/github_test/chunli_dev$ git push -u origin master Warning: Permanently added the RSA host key for IP address ‘192.30.253.113‘ to the list of known hosts. Counting objects: 5, done. Delta compression using up to 4 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 321 bytes | 0 bytes/s, done. Total 3 (delta 1), reused 0 (delta 0) remote: Resolving deltas: 100% (1/1), completed with 1 local objects. To git@github.com:990487026/chunli_dev 74de7b3..2297efc master -> master Branch master set up to track remote branch master from origin. chunli~魂斗罗~/github_test/chunli_dev$ echo $? 0 chunli~魂斗罗~/github_test/chunli_dev$
验证看图:5
忽略二进制文件:
chunli~魂斗罗~/github_test/chunli_dev$ vim .getignore chunli~魂斗罗~/github_test/chunli_dev$ cat .getignore *.o chunli~魂斗罗~/github_test/chunli_dev$ touch haha.o chunli~魂斗罗~/github_test/chunli_dev$ git add * chunli~魂斗罗~/github_test/chunli_dev$ git commit -m "ignore" chunli~魂斗罗~/github_test/chunli_dev$ git push -u origin master chunli~魂斗罗~/github_test/chunli_dev$
本文出自 “魂斗罗” 博客,谢绝转载!
Linux git 多人协助开发实战