工具 --- Git使用

创建远程仓库 Github

  • 首相在GitHub网站创建一个仓库:右上角加号➕,选择new repository

    

  • 然后创建编辑仓库:名称、说明、是否公开、语言、分支风格等信息。然后创建。

    

  • 复制仓库地址

    

远程仓库下拉到本地

  • 首先进入到工作目录文件夹:cd pywrod/GitProject/
  • 下拉仓库到本地的文件夹中:git clone https://github.com/guoyapeng/GitText.git
  • 进入到下拉下来的文件夹中:cd GitText
    • 查看文件夹内的内容:ls
    • 产看当前的工作状态:git status
      • On branch master
      • Your branch is up to date with 'origin/master'.
      • nothing to commit, working tree clean

本地创建py虚拟环境

  • 创建python开发虚拟环境:python3 -m venv .venv
    • 用python3内置的venv模块创建虚拟环境,python3.6以上才可以用
  • 激活刚刚创建的虚拟环境:source .venv/bin/activate
  • 此时git status查看状态并请求没有发生改变,说明git没有跟踪虚拟环境文件的创建
  • 这是因为我们虚拟环境文件被加载到了.gitignore文件中,加到此文件中的都会被忽略掉

本地仓库创建分支

# 创建 develop 分支
git branch develop
git checkout develop
git add .
git commit -m "create new develop branch"
git push --set-upstream origin develop

 

猜你喜欢

转载自www.cnblogs.com/TMMM/p/12077601.html