![eaea48204c0369d113946df9eec4cf73.png](https://i-blog.csdnimg.cn/blog_migrate/c08c578216d47b45bc89662f27e989ed.jpeg)
引言
我是git
的小白用户,仅以此文记录我用到过的所有git
命令。
设置用户名与邮箱
git config --global user.name <username>
git config --global user.email xxx@xx.com
下载网络端仓库到本地
git clone <url>
编辑完成向服务器推送(素质三连)
git add . # 项目根目录下运行
git commit -m "guess it!" # 这次变动干了什么
git push # 推送至服务器
获取服务器处的更新(拉取)
git pull
放弃本地修改,用服务器端内容覆盖本地内容
# 方法一:删掉本地仓库,重新下载一份, enjoy!
# rm -rf / && git clone <url> # 不要执行!!!
# 方法二:
git fetch --all
git reset --hard origin
强制推送本地副本到服务器(谨慎)
git push --force