github - 未找到提交
github - commits not found
使用github时,我通常是这样做的:
git pull
以确保所有内容都是最新的
git add .
添加我的所有更改
git commit -m "some message"
提交我的更改
git push
推送我的更改
本地文件每次修改后,我都做同样的操作,然后去网站上查看。变化就在那里,每个人都可以看到。它们存在于本地和远程仓库中。但是偶尔,我所有的提交都会消失,并且它们会以某种方式被丢弃。我注意到,只要在同一个回购上工作的同事进行更改,就会发生这种情况。
如果这有帮助:
git log
显示我的提交已记录
git checkout master
说我已经上master了。
我的 Github 配置文件显示我向存储库提交了 X 次提交,但是当我单击它们时,它显示 "commits not found".
在 master 分支上时,git push
和 git push origin master
不同吗?
我想知道我是否在这里做错了什么,这样我就可以在以后的提交中避免这样做。
The problem is when he makes a commit, all my changes are gone. They're not even in the history. It's like he is creating a whole new repository every time he makes a change.
只有他强行推动才会发生这种情况
git push --force
在 GitHub,你至少可以 protect your master
branch。
When on the master
branch, are git push
and git push origin master
different?
你可以检查output of git branch -avv
:它应该显示 master 有一个上游(远程跟踪)分支 origin/master
。那样的话,git push
就够了。
参见“Why do I need to explicitly push a new branch?”
使用github时,我通常是这样做的:
git pull
以确保所有内容都是最新的git add .
添加我的所有更改git commit -m "some message"
提交我的更改git push
推送我的更改
本地文件每次修改后,我都做同样的操作,然后去网站上查看。变化就在那里,每个人都可以看到。它们存在于本地和远程仓库中。但是偶尔,我所有的提交都会消失,并且它们会以某种方式被丢弃。我注意到,只要在同一个回购上工作的同事进行更改,就会发生这种情况。
如果这有帮助:
git log
显示我的提交已记录git checkout master
说我已经上master了。我的 Github 配置文件显示我向存储库提交了 X 次提交,但是当我单击它们时,它显示 "commits not found".
在 master 分支上时,git push
和 git push origin master
不同吗?
我想知道我是否在这里做错了什么,这样我就可以在以后的提交中避免这样做。
The problem is when he makes a commit, all my changes are gone. They're not even in the history. It's like he is creating a whole new repository every time he makes a change.
只有他强行推动才会发生这种情况
git push --force
在 GitHub,你至少可以 protect your master
branch。
When on the
master
branch, aregit push
andgit push origin master
different?
你可以检查output of git branch -avv
:它应该显示 master 有一个上游(远程跟踪)分支 origin/master
。那样的话,git push
就够了。
参见“Why do I need to explicitly push a new branch?”