创新实训(二)前期准备-环境

环境搭建

python版本统一3.8.2

GitHub学习使用

安装git

git的命令:
  • 初始化一个Git仓库,使用git init命令。

  • 添加文件到Git仓库,分两步:

    使用命令git add <file>,注意,可反复多次使用,添加多个文件;
    使用命令git commit -m <message>

  • HEAD指向的版本就是当前版本,因此,Git允许我们在版本的历史之间穿梭,使用命令git reset --hard commit_idgit reset --hard HEAD^返回上一版本,^的数量表示回到上几个版本,也可以用HEAD-100表示返回上100个版本

  • 穿梭前,用git log可以查看提交历史,以便确定要回退到哪个版本

  • 要重返未来,用git reflog查看命令历史,以便确定要回到未来的哪个版本。

git add把文件添加进去,实际上就是把文件修改添加到暂存区
git commit提交更改,实际上就是把暂存区的所有内容提交到当前分支

  • git status查看暂存区的状态
  • git reset HEAD <file>可以把暂存区的修改撤销掉,重新放回工作区,即撤销add的操作
  • 想直接丢弃工作区的修改时,用命令git checkout -- file
  • 使用命令git remote add origin git@github.com:path/repo-name.git关联一个远程库
  • 关联后,使用命令git push -u origin master第一次推送master分支的所有内容
  • 此后,每次本地提交后,只要有必要,就可以使用命令git push origin master推送最新修改
  • git clone git@github.com:michaelliao/gitskills.git克隆远程仓库
  • 创建并切换到新的dev分支,git switch -c dev
  • 直接切换到已有的master分支,git switch master
  • 查看分支:git branch
  • 创建分支:git branch <name>
  • 切换分支:git checkout <name>或者git switch <name>
  • 创建+切换分支:git checkout -b <name>或者git switch -c <name>
  • 合并某分支到当前分支:git merge <name>
  • 删除分支:git branch -d <name>
  • git merge --no-ff -m "merge with no-ff" <branch-name>禁用fast forward
  • git pull从远程库更新本地
  • 如果git pull提示no tracking information,则说明本地分支和远程分支的链接关系没有创建,用命令git branch --set-upstream-to <branch-name> origin/<branch-name>

git add
git commit -m ‘’
git push

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值