Git   发布时间:2022-05-05  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了Git Commands大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

Git Version

$ git --version

Git Config

1. set user name,email

$ git config --global user.name MudOnTire

$ git config --global user.email 895157882@qq.com

2. get config

$ git config user.name

$ git config user.email

Repository

1. git init

$ git init

2. git status

$ git status

3. stage file

single file@H_616_41@
$ git add index.html 

all changed files@H_616_41@
$ git add .

4. unstage file

$ git rm --cache index.html

5. commit

@H_559_40@make commit@H_616_41@
$ git commit -m "add index and style files"

show history@H_616_41@
$ git log

show condensed commit@H_616_41@
$ git log --oneline

Undo Commits

1. checkout commit

$ git checkout 0e2a5f3

2. reattach to branch

$ git checkout master

3. revert commit (undo one particular commit)

$ git revert eb95c64

4. reset commits

soft (retain changes)@H_616_41@
$ git reset eb95c64

hard (erase all changes)@H_616_41@
$ git reset eb95c64 --hard

create branch

1. show branches

$ git branch -a

2. create a branch

$ git branch feature-1

3. switch to a branch

$ git checkout feature-1

4. delete a branch

$ git branch -D feature-1

5. create and then switch to a branch

$ git checkout -b feature-1
@H_848_0@merge branch

1. merge target branch to current branch

$ git merge [name_of_targeT_Branch]

2. push local branch to remote

$ git push origin [name_of_your_new_branch]

大佬总结

以上是大佬教程为你收集整理的Git Commands全部内容,希望文章能够帮你解决Git Commands所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: