我问过另一个问题,但意识到我错过了陈述,所以删除了它。 你如何用Git解决以下问题? 你有一个回购。 您克隆了repo并对源代码进行了一些更改。 在推送之前,您使用Github.com添加新文件(例如,您创建自述文件)。 如果您尝试推送,我认为您有合并冲突,但由于文件本身不包含冲突,因此修复似乎微不足道。 你是如何解决这个问题的?
我过去遇到过麻烦,我开始在本地工作,然后去制作一个repo并用自述文件(本地副本没有)初始化它并且出错了。
TL; DR我问如果本地仓库中有不同的文件(或者还没有初始化repo)和远程仓库会发生什么,但是各个文件不冲突。
I had asked another question but realized I miss-stated so deleted it. How do you resolve the following situation with Git? You have a repo. You clone the repo and make some changes to the source code. Before pushing, you use Github.com to add a new file (for example you create a readme file). I think you have a merge conflict if you try to push, but it seems trivial to fix since the files themselves don't contain conflicts. How do you resolve this?
I've had trouble in the past where I started working locally and went to make a repo and initialized it with a readme file (that the local copy didn't have) and got errors.
TL;DR I'm asking what happens if there are different files in the local repo (or the repo hasn't been initialized) and the remote repo, but the individual files don't conflict.
最满意答案
如果单个文件不冲突并且您尝试从本地存储库推送到同一分支上的远程存储库,则不会发生合并冲突。
最有可能的是,在推送您的更改之前,系统会提示您进行git pull 。 Git会认识到它们没有冲突的信息,当你运行git push时,本地存储库中的添加内容将被添加到远程存储库中。
没有必要改变或隐藏任何东西。
If the individual files don't conflict and you try to push from the local repository to the remote repository on the same branch, there will not be a merge conflict.
Most likely, you will be prompted to git pull before pushing your changes. Git will recognize they do not have conflicting information, and the additions on the local repository will be added to the remote repository when you run git push.
There's no need to rebase or stash anything.
更多推荐
发布评论