美文网首页
Git/GitHub

Git/GitHub

作者: 一任平生cq | 来源:发表于2019-12-07 21:36 被阅读0次

最近同时在两到三台电脑上写代码。Linux/Windows系统都有,感觉保持代码一致性很重要。所以想要学一些Git/GitHub,用这个来同步保存代码。其实,如果有云盘,直接用云盘备份同步(比如坚果云,OneDrive)也很好。

1. Git在自己电脑上的初次设置

git config --global user.name "自己的用户名"
# 设置自己的用户名
git config --global user.email "邮箱地址"

git config --global color.ui auto
#设置git 的命令行的颜色

2.创建本地仓库

git init
#初始化本地仓库
git clone git-url
#克隆远程仓库(已经存在在github)

3.添加文件进入本地仓库

git status
#查看本地仓库状态
git add 文件名
#添加文件
git commit -m "解释说明"
#提交说明

4.更新

git pull
#从远程仓库下载所有内容
git push origin master
#将本地仓库推送到远程仓库

参考

[1] https://github.github.com/training-kit/downloads/github-git-cheat-sheet.pdf
[2] https://education.github.com/git-cheat-sheet-education.pdf
[3] https://www.liaoxuefeng.com/wiki/896043488029600

相关文章

网友评论

      本文标题:Git/GitHub

      本文链接:https://www.haomeiwen.com/subject/shcpgctx.html