常用的GIT

# 初始化相关
git init
git add .
git commit -m "test001"
git remote origin https://github.com/fangfuGIT/fangfugit.github.io.git
git push -u origin master

从自己的账号下clone:

git clone https://github.com/fangfuGIT/fangfugit.github.io.git

删除已有的github远程库,名字叫origin:

git remote rm origin

关联新的origin远程库:

git remote add origin https://github.com/fangfuGIT/fangfugit.github.io

查看远程库信息:

git remote -v

推送到origin的远程库:

git push -u origin master  #第一次上传可用这个
git push origin master

注:origin可以改成其他名字。

整个提交:

git add .

提交单个文档:

git add index.html

创建快照并命名:

git commit -m "test1"

查看状态:

git status

查看修改了哪些内容:

大专栏   常用的GIT-rouge">
git diff

查看提交日志:

git log

放弃某个文档的所有本地修改

git checkout head file 

创建并切换到分支

git branch dev
git checkout dev

也可以用这个命令:

git checkout -b dev

查看分支

git branch

我们把dev分支的工作成果合并到master分支上:

git merge dev

删除dev:

git branch -d dev

pycharm也可以连接git,先去github上创建new repository
安装配置Git后,打开Pycharm。file–>Default Settings–>Version Control–>Git–Path to Git executable中选择git.exe
VCS–>checkout from version controller–>Git
在Git Repository URL 中填写git仓库的地址,点击确定,输入账号和密码,此时便可看到SVN仓库中的文档。

参考链接:

https://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000

Git Cheat Sheet 中文版

猜你喜欢

转载自www.cnblogs.com/lijianming180/p/12014292.html