Git使用

创建本地仓库

  • git init

跟踪

  • git add
  • git rm
  • git rm --chache

暂存

  • git add
  • git reset HEAD
  • git commit -m
  • git commit -am
  • git reset head~ --soft

查看文件状态

  • git status 红色是修改但没暂存
  • git diff
  • git log
  • git log --all
  • git log --pretty
  • git log --graph
  • git log --all --graph

远程仓库

  • git remote add orgin
  • git remote
  • git remote rename orgin origin
  • git push origin master
  • git puhsh -u origin master
  • git fetch
  • git pull(git fetch+git merge)
  • git pull --rebase(git fetch+git rebase)

SSH

  • cd ~/.ssh
  • ssh-keygen -t rsa -b 4096 -C “@qq.com”
  • cat test.pub

分支

  • git log
  • git status
  • git branch --list
  • git branch newbranch
  • git checkout newbranch
  • git checkout -b newbranch2
  • git merge newbranch
  • git checkout -b newbranch3 origin/newbranch3
  • git checkout --track origin/newbranch
  • git checkout HEAD^
  • git branch -f main HEAD~3

贮藏

  • git stash
  • git stash push
  • git stash apply
  • git stash list
  • git stash apply stash@{2}
  • git stash pop
  • git stash drop stash@{0}

重置

  • git reset HEAD~

  • git reset HEAD^

  • git rebase main

  • git rebase -i C3 C5

  • git rebase -i HEAD~4

  • git revert HEAD

  • git cherry-pick C3 C4 C7

  • git fetch

  • git rebase o/main或git merge o/main或git pull --rebase或git pull

  • git push

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值