Git最基本的7个功能使用方法

1、在project的文件夹下创建版本库
git init
2、例如将编写好的readme.txt添加到本地git仓库
git add readme.txt
git commit -m “here is the content that you want to describe this add edtion”
3、git status命令可以让我们时刻掌握仓库当前是否被修改过
git status
4、看看具体修改了什么内容
git diff readme.txt
5、本地创建了一个Git仓库后,又想在GitHub创建一个Git仓库,并且让这两个仓库进行关联。
git remote add origin [email protected]:huangxinkid/predict.git
6、把本地库的所有内容推送到远程库上(第一次推送master分支时,加上了-u参数,Git不但会把本地的master分支内容推送的远程新的master分支,还会把本地的master分支和远程的master分支关联起来,以后的推送或者拉取时就可以简化命令)
git push -u origin master #第一次时加上-u
git push origin master #以后把本地master分支的最新修改推送至GitHub
7、克隆远程仓库
git clone [email protected]:huangxinkid/predict.git

猜你喜欢

转载自blog.csdn.net/elite666/article/details/80721324