使用git管理代码

上传工程

1.登录github后,点击右上角带有+号的图标,输入仓库名创建仓库(Repository)。

2.在项目文件夹下执行以下命令:

touch README.md
git init

如果工程中有不需要或不打算上传的文件,创建一个.gitignore文件,在该文件中列出这些文件。如:

*.pyc
*.bak

然后执行

git add *
git commit -m "first commit"
git remote add origin https://github.com/***/项目名称.git
git push -u origin master

执行后会提示输入用户名和密码,我们需要输入git帐号和密码。

代码修改后的提交

git add *
git commit -m "first commit"
git push -u origin master

 

代码的下载

git clone https://github.com/***/项目名称.git

远程更新 (在服务器上获取你仓库的最新代码)

git pull origin master
 
 

 

原文地址:https://www.cnblogs.com/goodhacker/p/3235242.html