您的位置:首页 > 娱乐 > 明星 > Git使用

Git使用

2024/10/5 22:31:39 来源:https://blog.csdn.net/zzzzzucc/article/details/141135862  浏览:    关键词: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

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com