BOOKING

2019年4月19日星期五

GItHub 快速使用流程

首先安装GITCMD,个人比较喜欢,GIDDESKTOP时常出状况,有的时候无法更新,等等。

安装好之后,可以使用powershell,也可以用自带的cmd

建议在网页上创建好repositories,获取https://github.com/xxxx/xx的完整地址。
在本地安装好GITBASH之后,系统会自动生成代码仓库。在/GitHub最外层运行

Git Clone https://github.com/xxxx/xx.文件夹本地建立完成。



几个命令
git init 初始化repo

git status 列出未被添加到暂存区与未被提交到repo的修改(经常使用这个命令,对文件的修改以及提交情况会比较清楚)

git add <file> 添加修改到暂存区

git commit -m '<msg>' 提交修改到repo,并附上说明

git push 推送到远程仓库

git pull 从远程仓库拉取更新,并与本地对应分支合并

git branch 查看本地分支

git branch -a 查看远程分支

git branch <branch_name> 创建分支

git checkout <branch_name> 切换分支

git checkout -b <branch_name> 新建并切换分支

git merge 合并分支

git stash 保存工作区工作现场

git stash list 查看stash

git stash pop 恢复最后一个stash并删除stash数据

git stash apply <stash> 恢复指定stash

git stash drop <stash> 删除指定stash

git rm <file> 将文件从工作区删除

git branch -d <branch_name> 删除分支

git branch -D <branch_name> 强制删除未合并分支

git checkout -- <file> 把修改从工作区撤销

git reset HEAD <file> 把修改从暂存区撤销到工作区

git reset HEAD --hard <commit_id> repo版本回退到某个commit

git log 查看commit历史

git reflog 查看每个操作的log

没有评论:

发表评论