git常用命令

  很早就听说过git,也曾经尝试学习,但是总是因为各种原因使用的比较少,导致学的东西很快忘掉,今天又快速看了一下,总结一下,以备今后复习之用。我主要是看这个的做的http://files.cnblogs.com/pocean/git_tutorial.zip,其实挺简单的,就照着例子走一遍,然后日常的使用基本就够用了。

  

1、配置

     git config --global user.name "Your Name"
     git config --global user.email  "your_email@whatever.com"
     git config --global core.autocrlf input
     git config --global core.safecrlf true
 
~/.gitconfig
     [alias]
        co = checkout
        ci = commit
        st = status
        br = branch
        hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
        type = cat-file -t
        dump = cat-file -p
 

2、基础

     git init
     git add file
     git commit
     git status
     git log
     git checkout <hash>/tag
     git tag v1
     git tag v1^
     git hist master --all
     git checkout filename  //用于未add
     git reset HEAD filename //用于add后,未commit
     git revert HEAD
     git reset --hard hashname/tagname //删除commit
     git tag -d <tagname>
     git commit --ament
     git checkout -b branchname
     git merge brachname1(把1分支合并到所在的分支上)
     

3、交互

  git remote
  git remote show remotename
  git remote
  git branch -a
  git fetch+gitmerge=git push -f
  git brach --track greet origin/greet 根据把远程库的分支,在本地建立一个分支来追踪

4、github

  git remote add origin https://username@github.com/username/repname.git

  git push -f

 

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值