git
程序员文章站
2022-03-01 15:45:02
...
1. 强制上传
git push -u origin master -f
2. 本地创建分支并关联远程分支
- 在本地创建一个分支文件夹,并关联远程分支
git init
git remote add origin [email protected]:xiaoyisha/learngit.git
- $ git pull <远程主机名> <远程分支名>:<本地分支名>
如拉取远程的master分支到本地wy分支:
git pull origin master:wy
3. git pull 合并
error: Your local changes to the following files would be overwritten by merge:
src/main/java/chocopy/pa2/DeclarationAnalyzer.java
Please commit your changes or stash them before you merge.
git status
git add
git commit
git pull
4. 与fork的仓库同步
https://help.github.com/articles/configuring-a-remote-for-a-fork/
https://help.github.com/articles/syncing-a-fork/
5. 查看并reset本地commit
git config --global alias.tree "log --oneline --decorate --all --graph"
git tree
git reset --hard 42c1911