Common instructions of git(git常见指令)
git add .
add your codes to computer staging area
提交你的代码到暂存区
git status
view the status of added files in computer staging area
查看暂存区已提交文件状态
git commit -m "message"
add your codes to your local branch
添加你的代码到你的本地分支上
git pull origin ***
pull the latest codes of your branch to the locality,you can get the latest codes the branch.if you find the message is 'Already up to date' after you have pulled,it means that your branch's content is the latest.
拉取你的分支最新的代码到本地,你可以得到该分支最新的代码,如果在你拉取完代码后发现消息是‘Already up to date’,意味着你的代码内容是最新的。
git push origin ***
push your latest codes to your origin branch。
把你的最新代码推到远程分支上。
git checkout -b 'test'
create a new branch named 'test' and switch to the new branch
创建一个新的分支,而且切换到该分支下
git reset --soft HEAD^
reset your codes to 'added' status,for example,if you have done 'git commit -m ...',but you want to back,you can use the instruction
回退你的代码到added状态,举一个例子,你已经做了commit指令,你想返回,你用这个指令
git reset HEAD^
reset your codes to the status of before adding,for example,if you have done 'git commit -m ...',but you want to back to the initial state,you can use the instruction.then you want to add your codes again,you need to use 'git add .'
回退你的代码到提交之前状态,举一个例子,如果你已经commit了,但是你想回到初始的状态,你可以用这个指令,然后你想再次提交你的代码,你需要用git add .
git reset --mixed HEAD^
the effect is the same as 'git reset HEAD^ '
效果和git reset HEAD^一样
git reset --hard HEAD^
use this carefully,beacause this can let your codes lose.Unless you don't need it
慎重用这个,因为这个可以让你的代码丢失,除非你不需要
git stash/ git stash save 'test1'
when you were writing your codes,someone told you need develop other content at another branch,you can use it to store you codes
当你正在写代码的时候,有人告诉你需要在其他分支开发内容,你可以用这个指令储存代码。
git stash pop / git stash pop stash${}
you can make you stored codes to branch you need,use it with 'git stash'
你可以把你储存的代码到你需要的分支上,和git stash配合使用
git stash apply/ git stash apply stash${}
it's effect is same as 'git stash pop',when do you use it?if you don't want the content of stash list,you use 'git stash pop' ,if no,you use 'git stash apply'
这个效果和git stash pop一样,那什么时候我们用这个呢,如果你不想要stash列表中的内容,你用git stash pop,如果你想要,你用‘git stash apply’
原文地址:https://blog.csdn.net/2201_75705263/article/details/140688185
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!