3、Git基本的工作流程
2016-05-24 16:40
399 查看
Git 使用40个16进制字符的SHA-1 Hash来唯一标识对象
4a21da353d21312d1231f1212e123124
Git有4种对象
1 blob
2 tree
3 commit
4 tag
得到Git仓库的两种途径
1、git init 【file name】
2、git clone 【已有的仓库名称或者远程的地址】【[clone到本地的名称】
=======================================================================================================
如果不想添加XXX文件,创建.git_ignore
git add .gitignore
4a21da353d21312d1231f1212e123124
Git有4种对象
1 blob
2 tree
3 commit
4 tag
得到Git仓库的两种途径
1、git init 【file name】
2、git clone 【已有的仓库名称或者远程的地址】【[clone到本地的名称】
=======================================================================================================
songyanchengdeMacBook-Pro:~ Jax$ git init Jax_git Initialized empty Git repository in /Users/Jax/Jax_git/.git/ songyanchengdeMacBook-Pro:~ Jax$ cd Jax_git/ songyanchengdeMacBook-Pro:Jax_git Jax$ touch a songyanchengdeMacBook-Pro:Jax_git Jax$ touch b songyanchengdeMacBook-Pro:Jax_git Jax$ git add a b songyanchengdeMacBook-Pro:Jax_git Jax$ git status On branch master Initial commit Changes to be committed: (use "git rm --cached <file>..." to unstage) new file: a new file: b songyanchengdeMacBook-Pro:Jax_git Jax$ git commit -m "init commit" [master (root-commit) fb81826] init commit Committer: Jax <Jax@songyanchengdeMacBook-Pro.local> Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly. Run the following command and follow the instructions in your editor to edit your configuration file: git config --global --edit After doing this, you may fix the identity used for this commit with: git commit --amend --reset-author 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 a create mode 100644 b
songyanchengdeMacBook-Pro:Jax_git Jax$ vim a songyanchengdeMacBook-Pro:Jax_git Jax$ git status On branch master 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: a no changes added to commit (use "git add" and/or "git commit -a")
songyanchengdeMacBook-Pro:Jax_git Jax$ git add a songyanchengdeMacBook-Pro:Jax_git Jax$ git status On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage) modified: a songyanchengdeMacBook-Pro:Jax_git Jax$ git commit -m "modify a" [master 31a1b55] modify a Committer: Jax <Jax@songyanchengdeMacBook-Pro.local> Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly. Run the following command and follow the instructions in your editor to edit your configuration file: git config --global --edit After doing this, you may fix the identity used for this commit with: git commit --amend --reset-author 1 file changed, 1 insertion(+)
songyanchengdeMacBook-Pro:Jax_git Jax$ git rm a rm 'a' songyanchengdeMacBook-Pro:Jax_git Jax$ ls b songyanchengdeMacBook-Pro:Jax_git Jax$ git status On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage) deleted: a
songyanchengdeMacBook-Pro:Jax_git Jax$ git reset HEAD a Unstaged changes after reset: D a songyanchengdeMacBook-Pro:Jax_git Jax$ ls b songyanchengdeMacBook-Pro:Jax_git Jax$ git checkout a songyanchengdeMacBook-Pro:Jax_git Jax$ ls a b
songyanchengdeMacBook-Pro:Jax_git Jax$ git rm --cached a rm 'a' songyanchengdeMacBook-Pro:Jax_git Jax$ git status On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage) deleted: a Untracked files: (use "git add <file>..." to include in what will be committed) a songyanchengdeMacBook-Pro:Jax_git Jax$ git add a
songyanchengdeMacBook-Pro:Jax_git Jax$ git mv a c songyanchengdeMacBook-Pro:Jax_git Jax$ git status On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage) renamed: a -> c
如果不想添加XXX文件,创建.git_ignore
git add .gitignore
相关文章推荐
- HDU 1669 Monkey and Banana
- JavaScript学习
- RRC连接重配置
- java中GC回收和内存分配
- 《统计学习方法》——概论
- Unity3D中的Update, FixedUpdate, LateUpdate的区别
- file_put_contents 错误:failed to open stream: Invalid argument 一种原因
- BBC英语-drama
- IP地址中的保留地址
- Ubuntu下U盘文件只读的解决办法
- R语言学习之路(二)矩阵
- Contains Duplicate
- Lua读取文件和写入文件
- 用C语言制作Web服务器
- 安卓盒子launcher界面开发之添加自动定位,获取当地天气
- @Aspect注解无效
- 对称密码-流密码
- flask_socketio 使用范例
- 使用Unicorn-engine 续1
- typedef与#define的区别