一、背景:先前都是用git命令进行代码同步操作,今天试了pycharm IDE进行代码同步,个人感觉差不多,下面介绍基本步骤(以github为例)
二、使用流程:
2.1 安装git(这里不介绍了),配置git路径
配置git路径.png
2.2 接下来在github上创建一个自己的Repository,创建成功后,在右上角复制 clone and download的链接https://github.com/XXX/git-test.git
2.3 在pycharm里面clone刚创建的项目下来
image.png
image.png
clone后,以New Window打开
2.4 在打开的窗口中新建几个文件并git add 操作
image.png
2.5 git commit操作并在commit message中编辑commit tag
image.png
2.6 点击右下角commit and push
image.png
2.7 在首次push时,会提示输入github账号和密码,登录成功后,代码就同步到github创建的仓库
2.8 如果担心没有提交成功,选择git - > repository - > push,右侧是否为空来判断是否同步到仓库
image.png
image.png
注:如果想把之前创建的项目,同样在github上创建一个仓库,然后使用git bash命令环境下git clone https://github.com/XXX/git-test.git下来,接着将这个下载下来的文件夹下.git文件复制到之前项目下,在git bash环境下执行
git add .
git commit -m "first commit"
git push origin master
同步成功后,下次就可以直接在pycharm里面进行git add commit push三操作了