github与git快速入门

github与git快速入门

1、在github官网建立仓库,官网地址是https://github.com/
2、建立好仓库后即可下载在本地linux系统中,使用命令git clone 仓库地上,比如我的是
git clone https://github.com/ethynyk/testgit.git
3.克隆下来后已经默认创建好了主分支与远程仓库地址
查看分支命令:git branch -a
查看远程仓库地址:git remote -v
4. 建立分支命令:git checkout -b branch-name (branch-name即为分支名字)
5.切换分支命令:git checkout branch-name
6.添加追踪文件到临时库: git add file-name (. 表示当前所有更改的文件或新加的文件)
7.提交到本地仓库: git commit
8.提交到远程仓库:git push 远程仓库地址 分支名
如我的远程仓库是origin,origin是远程仓库地址的别名,也可用web地址。
9.如果是多个分支都有修改需要合并到主分支,可用merge
先用命令切换到主分支:git checkout master
合并: git merge branch-name
合并后别忘记提交到远程仓库:git push origin master

猜你喜欢

转载自blog.csdn.net/humanspider1/article/details/70196989