1.初始化
git init
2.创建.gitignore
touch .gitignore
3.查看状态
git status
4.添加到暂存区
git add . 添加全部文件
git add 单个文件
5.git reset HEAD 命令用于取消已缓存的内容
git reset HEAD 文件名
6.使用 git add 添加暂存区,git commit 将缓存区内容添加到仓库中,必须写注释
git commit -m '版本提交'
git commit -am '跳过add ,直接提交'
7.配置远程仓库
git remote add origin https://github.com/hyghub/javanotes.git
8.推送远程仓库
git push -u origin develop(分支)
git pull --rebase origin develop --如果报错先更新,执行此命令!
9.拉取项目/克隆仓库
git clone https://github.com/hyghub/javanotes.git
10.查看历史记录
git log
git show
11.git强制覆盖:
git fetch --all
git reset --hard origin/master
git pull