$ git config --list
可以查看配置的一些东西。可以看到user.name 和user.email 分别是什么。。
如果你没有初始化过。那么直接:
$ git config --global user.name "输入你的用户名"
$ git config --global user.email "输入你的邮箱"
一、commit到本地,但没有push
1. 找到上次Git commit的 id
git log
找到你想撤销的<commit_id>
2. git reset --hard <commit_id>
完成撤销,同时将代码恢复到前一<commit_id> 对应的版本。
3. git reset <commit_id>
完成Commit命令的撤销,但是不对代码修改进行撤销,可以直接通过git commit 重新提交对本地代码的修改。
方法二:push之后的回退方法
git reset --hard <commit_id>
git push origin HEAD --force
====20:01 Can't Update====================================================================
No tracked branch configured for branch bug_SpringAOP_20180403 or the branch doesn't exist.
To make your branch track a remote branch call, for example,
git branch --set-upstream-to origin/bug_SpringAOP_20180403 bug_SpringAOP_20180403 (show balloon)
原因:新建了分支,只是在本地存在,需要push。执行:git -c core.quotepath=false -c log.showSignature=false push --progress --porcelain origin refs/heads/dev:dev --set-upstream
或者:idea操作:
====Push failed==================================================================
17:21 Push failed
Failed with error: AggregateException encountered.
repository 'https://github.com/NewBanker/gwy2.git/'; not found
https://stackoverflow.com/questions/37813568/git-remote-repository-not-found
https://stackoverflow.com/questions/25947059/git-clone-repository-not-found
====git merge===================================================================
current: master
选中dev->merge
Version Control Console中显示:
15:36:21.267: [renren-security] git -c core.quotepath=false -c log.showSignature=false merge origin/dev
下面这张图,应该是说,要把本地的master分支的代码push到远程的master仓库:
然后点击了push之后,打印了这句:
来源:oschina
链接:https://my.oschina.net/anxiaole/blog/3137538