Common instructions of git(git常见指令)

embedded/2024/10/22 18:32:21/

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’


http://www.ppmy.cn/embedded/86699.html

相关文章

【2024最新华为OD-C/D卷试题汇总】[支持在线评测] 开源项目热度排行榜(100分) - 三语言AC题解(Python/Java/Cpp)

🍭 大家好这里是清隆Coding ,一枚热爱算法的程序员 ✨ 本系列打算持续跟新华为OD-C/D卷的三语言AC题解 👏 感谢大家的订阅➕ 和 喜欢💗 🍿 最新华为OD机试D卷目录,全、新、准,题目覆盖率达 95% 以上,支持题目在线评测,专栏文章质量平均 93 分 最新华为OD机试目录…

国科大作业考试资料-人工智能原理与算法-2024新编-第十二次作业整理

袋子里面有3个有偏差的硬币a、b和c,抛掷硬币正面朝上的概率分别是20%、60%和80%。从袋 子里随机取出一个硬币(3个硬币被取出的概率是相等的),并把取出的硬币抛掷3次,得到抛掷结 果依次是X1 , X2和 X3。 a. 画出对应的贝叶斯网络并定义必要的CPT表。 b. 如果抛掷结果是…

Angular由一个bug说起之八:实践中遇到的一个数据颗粒度的问题

互联网产品离不开数据处理,数据处理有一些基本的原则包括:准确性、‌完整性、‌一致性、‌保密性、‌及时性。‌ 准确性:是数据处理的首要目标,‌确保数据的真实性和可靠性。‌准确的数据是进行分析和决策的基础,‌因此…

eclipse ui bug

eclipse ui bug界面缺陷,可能项目过多,特别maven项目过多,下载,自动编译,加载更新界面异常 所有窗口死活Restore不回去了 1)尝试创建项目,还原界面,失败 2)关闭所有窗口&…

labview四字节转浮点数

1.labview四字节转浮点数 2.Labview怎么把串口接收到的数据转换成浮点数? Labview怎么把串口接收到的数据转换成浮点数?

AI有关的学习和python

一、基本概念 AIGC(AI Generated content AI 生成内容) AI生成的文本、代码、图片、音频、视频。都可以成为AIGC。 Generative AI(生成式AI)所生成的内容就是AIGC AI指代计算机人工智能,模仿人类的智能从而解决问题…

TCP的FIN报文可否携带数据

问题发现: 发现FTP-DATA数据传输完,TCP的挥手似乎只有两次 实际发现FTP-DATA报文中,TCP层flags中携带了FIN标志 piggyback FIN 问题转化为 TCP packet中如果有FIN flag,该报文还能携带data数据么? 答案是肯定的 RFC7…

爬取百度图片,想爬谁就爬谁

前言 既然是做爬虫,那么肯定就会有一些小心思,比如去获取一些自己喜欢的资料等。 去百度图片去抓取图片吧 打开百度图片网站,点击搜索xxx,打开后,滚动滚动条,发现滚动条越来越小,说明图片加载…