git 简单使用 命令 ,最初级入门

git download
use git or github  ,github looks more good
http://windows.github.com github for windows

git 设置用户信息
$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com

check your config  info
git config user.name


very good doc
https://git-scm.com/book/zh/v2/Git-%E5%9F%BA%E7%A1%80-%E8%8E%B7%E5%8F%96-Git-%E4%BB%93%E5%BA%93


个人本地laotop
在现有目录中初始化仓库
git Init
追踪 提交
$ git add *.c
$ git add LICENSE
$ git commit -m 'initial project version'

克隆现有的仓库
git clone https://github.com/libgit2/libgit2  mylibgit     # 自定义项目名字


最常用的cmd
$ git status

跟踪新文件
git add filename

状态简览
git status -s

忽略文件
$ cat .gitignore

git diff
git diff --cached


提交更新
git commit -m "Story 182: Fix benchmarks for speed"

跳过使用暂存区域(Git 就会自动把所有已经跟踪过的文件暂存起来一并提交,从而跳过 git add 步骤)
git commit -a -m 'added new benchmarks

移除文件

移动文件
git mv file_from file_to

查看提交历史
git clone
git log

查看远程仓库
git remote
git remote -v

添加远程仓库
git remote add pb https://github.com/paulboone/ticgit
git remote -v
git fetch pb

推送到远程仓库
git push [remote-name] [branch-name]
git push origin master
当你和其他人在同一时间克隆,他们先推送到上游然后你再推送到上游,你的推送就会毫无疑问地被拒绝。 你必须先将他们的工作拉取下来并将其合并进你的工作后才能推送。

查看远程仓库
查看远程仓库
git remote show [remote-name]
git remote show origin

 Git 的杀手级特性:分支模型
 
 创建分支
 git branch testing
 
 git log 命令查看各个分支当前所指的对象
 git log --oneline --decorate
 
 分支切换
 git checkout testing
 
 切换回 master 分支看看
 git checkout master
 
 分支的新建与合并
 
 git checkout -b iss53
 ==
 git branch iss53
 git checkout iss53
 最好的方法是,在你切换分支之前,保持好一个干净的状态。
 
 在master 基础上构建一个 新的分支
 git checkout -b hotfix
 
 hotfix  合并到master  
 git checkout master
 git merge hotfix
 
 合并后 删除 hotfix  分支
 git branch -d hotfix
 
 
 遇到冲突时的分支合并
 
 
 后面还没有阅读
 https://git-scm.com/book/zh/v2/Git-%E5%88%86%E6%94%AF-%E5%88%86%E6%94%AF%E5%BC%80%E5%8F%91%E5%B7%A5%E4%BD%9C%E6%B5%81
 
 
 

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值