推送并提交给github,但显然只有一些变化
问题描述:
我已经提交并将我的更改推送到github.com,但是当我删除本地目录并将该repo克隆到本地计算机时,我得到一组反映在上次提交中添加新文件以及上次提交中删除的文件缺失。我在做什么不是 get是在上次提交中修改的文件,也就是我收到的文件,但它们是旧版本。推送并提交给github,但显然只有一些变化
我还需要做什么其他步骤?
之后,我对自述文件做了一个小小的编辑,我注意到有一个消息“你的分支在1位提交'之前是'origin/master'。”这是什么意思,我该如何解决它
[email protected]:~/backup9$ git commit
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
modified: README.md
no changes added to commit
[email protected]:~/backup9$ git add README.md
[email protected]:~/backup9$ git commit
[master b4c856a] Improve the formatting of README.md.
1 file changed, 22 insertions(+), 5 deletions(-)
[email protected]:~/backup9$ git push https://github.com/H2ONaCl/backup9.git master
Username for 'https://github.com': H2ONaCl
Password for 'https://[email protected]':
Counting objects: 5, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 509 bytes | 0 bytes/s, done.
Total 3 (delta 2), reused 0 (delta 0)
To https://github.com/H2ONaCl/backup9.git
f082024..b4c856a master -> master
[email protected]:~/backup9$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working directory clean
编辑:?我删除了目录,并再次克隆似乎正在从GitHub收到README.md修改,但是修改其他文件都没有,也就是说,其他文件仍然是旧版本。
答
在你的顺序中,你只能添加和提交README.md
,所以一个新的克隆会反映这个修改。
如果你想一定要包括所有的修改/添加/删除:
git add -A .
git commit -m "new commit"
git push
是的,但在之前的序列中未显示,我添加的文件,删除的文件,并修改文件。添加和删除可用于重新克隆,但不能进行修改。 – H2ONaCl
@ H2ONaCl当然:下次尝试'git add -A .',看看它是否更好。请检查这些文件是否被'git check-ignore -v - myfile'忽略。 – VonC
了解,谢谢。我会尝试。 – H2ONaCl