git config --global user.name "yangfuyuan"
git config --global user.email "yfy18916597106@gmail.com"
git config --global --list
git config --system --list
git config -l
git init
git status
git remote add origin <你的项目地址>
git pull -u origin master
git add .
git rm --cached <file>...
git restore --staged <file>...
git reset HEAD <file>
git rm <file>
git commit -m ''
git log
git log --pretty=oneline
git log --graph --pretty=oneline
git diff HEAD -- 文件名
git push origin master
git reflog
git reset --hard HEAD^
git reset --hard HEAD~50
git reset --hard
唯一标识
git ls-files
git config user.name
git config user.email
ssh-keygen -t rsa -C "yfy18916597106@gmail.com"
ssh -T git@gitee.com
ssh -T git@github.com
git branch
git checkout branch_name
git checkout -b branch_name
git branch -m|-M old_branch_name new_branch_name
git checkout master
git merge other_branch_name
git branch -d|-D other_branch_name
git branch -a
git push origin branch_name
git push origin :branch_name
git fetch
git checkout -b branch_name origin/branch_name
git pull
git push
git tag
git tag -a tag_name -m 'message' 唯一标识
git push origin --tags
git push origin :refs/tags/tag_name
git tag -d local_tag_name
提交的时候忽略一些文件:
- idea安装ignore插件
- 右键文件,添加到ignore,将修改好后的.ignore文件提交到远程仓库
- 注意,只有没有提交到暂存区的文件才能在.ignore文件中配置生效
![image-20211225011933025](https://img-blog.csdnimg.cn/img_convert/f1cd4b922c2fb759bfc17d38bc667742.png)
git工作原理图: ![image-20211225010539041](https://img-blog.csdnimg.cn/img_convert/e18b6fa91424ee862944347ea22da283.png)
![image-20211225011027270](https://img-blog.csdnimg.cn/img_convert/276466c425b652259f819eb7a7a949e1.png)
|