GIT 开始一次旅行 二 (git 本地基本 操作)
2014-01-12 21:57
465 查看
参考 http://rogerdudler.github.io/git-guide/index.zh.html PPT。
http://git-scm.com/book
写的非常的好对于初学git的 童鞋们。
自己/home建立一个git实例:
mkdir git_test
cd git_test
git init
1. 学会clone:
1082 mkdir git_test_2
1083 ls
1084 cd git_test_2/
1085 ls
1086 git clone ~/git_test
2.学会 提交文件
1097 cd git_test
1098 ls
1099 ls -la
1100 vim hello.c
1101 ls
1102 git add hello.c
1103 git log
1104 git show
1105 git commit -m "add hello.c"
1106 git log
1107 git show
3.学会 创建分支,切换分支,显示分支
1109 git checkout -b feature_x
1110 git checkout master
1111 git checkout feature_x
1112 ls
1113 git log
1114 ls
1115 git branch -a
4. 学会 merge 分支 把feature_x 分支 merge 到master上
1126 git checkout feature_x
1127 ls
1128 vim hello.c
1129 git log
1130 ls
1131 git add hello.c
1132 git show
1133 ls
1134 git branch -a
1135 git commit -m "add feature"
1136 git log
1137 git show 257cca
1138 ls
1139 git checkout master
1140 git merge feature_x
1141 git log
1142 git show
5. 解决冲突问题
1149 git checkout master
1150 ls
1151 vim hello.c
1152 git add hello.c
1153 git commit -m "conflict_master"
1154 git show
1155 git checkout feature_x
1156 vim hello.c
1157 git add hello.c
1158 git commit -m "conflicts_feature"
1159 git checkout master
1160 git merge feature_x
1161 git diff master feature_x
1162 ls
1163 git branch -a
1164 vim hello.c
1165 git add hello.c
1166 git merge feature_x
1167 git commit -m "merge OK use master"
1168 git merge feature_x
1169 hitory
1170 history
note:
你懂得。
master branch:
#include <stdio.h>
int main()
{
printf("hello git\n");
printf("hello liuchunhaiadd feature\n");
}
~
feature_x branch
#include <stdio.h>
int main()
{
printf("hello git\n");
printf("hello feature add feature\n");
}
~
~
~
http://git-scm.com/book
写的非常的好对于初学git的 童鞋们。
自己/home建立一个git实例:
mkdir git_test
cd git_test
git init
1. 学会clone:
1082 mkdir git_test_2
1083 ls
1084 cd git_test_2/
1085 ls
1086 git clone ~/git_test
2.学会 提交文件
1097 cd git_test
1098 ls
1099 ls -la
1100 vim hello.c
1101 ls
1102 git add hello.c
1103 git log
1104 git show
1105 git commit -m "add hello.c"
1106 git log
1107 git show
3.学会 创建分支,切换分支,显示分支
1109 git checkout -b feature_x
1110 git checkout master
1111 git checkout feature_x
1112 ls
1113 git log
1114 ls
1115 git branch -a
4. 学会 merge 分支 把feature_x 分支 merge 到master上
1126 git checkout feature_x
1127 ls
1128 vim hello.c
1129 git log
1130 ls
1131 git add hello.c
1132 git show
1133 ls
1134 git branch -a
1135 git commit -m "add feature"
1136 git log
1137 git show 257cca
1138 ls
1139 git checkout master
1140 git merge feature_x
1141 git log
1142 git show
5. 解决冲突问题
1149 git checkout master
1150 ls
1151 vim hello.c
1152 git add hello.c
1153 git commit -m "conflict_master"
1154 git show
1155 git checkout feature_x
1156 vim hello.c
1157 git add hello.c
1158 git commit -m "conflicts_feature"
1159 git checkout master
1160 git merge feature_x
1161 git diff master feature_x
1162 ls
1163 git branch -a
1164 vim hello.c
1165 git add hello.c
1166 git merge feature_x
1167 git commit -m "merge OK use master"
1168 git merge feature_x
1169 hitory
1170 history
note:
你懂得。
master branch:
#include <stdio.h>
int main()
{
printf("hello git\n");
printf("hello liuchunhaiadd feature\n");
}
~
feature_x branch
#include <stdio.h>
int main()
{
printf("hello git\n");
printf("hello feature add feature\n");
}
~
~
~
相关文章推荐
- GIT 开始一次旅行 四 (git 远程基本 操作)
- Git使用教程之本地仓库的基本操作
- Git_Git本地操作_第3课_Git基本工作流程
- 记录一次操作git 的愚蠢行为(本地代码只 git add 过,没有 commit ,push 过,然后版本回退 导致本地代码丢失)
- GIT 开始一次旅行 三 ( 建立一个github 远程 仓库)
- Git使用教程之本地仓库的基本操作
- Android入门教程九之Git使用教程之本地仓库的基本操作
- GIT 开始一次旅行 一 (git 初始化和配置)
- Git最佳实践-本地仓库基本操作
- Git_Git基本操作_第5课_Git本地分支与合并
- Android基础入门教程——1.5.1 Git使用教程之本地仓库的基本操作
- Git学习笔记(4)----基本操作及命令(本地仓库篇)
- 记录一次操作git 的愚蠢行为(本地代码只 git add 过,没有 commit ,push 过,然后版本回退 导致本地代码丢失)
- Git使用本地仓库之基本操作
- git 的本地基本操作
- Git使用本地仓库之基本操作
- Git使用本地仓库之基本操作--版本回退,后悔怎么办,撤销未提交的修改
- Git使用本地仓库之基本操作
- Git使用本地仓库之基本操作
- git基本操作