我是新来的Git和尝试很多事情之后发布此。新的git:混帐推给错误
问题很简单:我有一个文件说,在主“A”,它也存在于其他分支说,“测试”。在这两个文件中,有变化,我要合并更改
我知道有很多以前的帖子,哪些社区可以指导我,但我有一个具体的问题,我无法解决:
所以这里有一点事情,我已经试过
- 我现在的分支的分支“测试”和本地系统(在git的目录)文件显示从branch.Now我已经合并的变化而变化从主所以我切换到主使用git结帐命令
- 然后,使用git拉原产主,也Git的mer ge测试,因为我必须将master从master更改为'test'分支。在努力,这两个命令显示有在文件“A”冲突(如错误的:合并是因为未合并的文件无法自动合并失败等....)
- 然后,搜索这些错误,并建议通过我们手动使用像kdiff等一些工具
现在在这里,我的问题上来合并文件职位数:
我可以在Github上(资料库)在主轻松复制现在的变化分支并更新git本地存储库中的文件(它的版本是Branch'test')。我的问题是:git如何知道合并完成?我甚至做到了,并再次运行命令“混帐推起源大师”,但很可以理解的,它没有说,当前分支的末端是背后....等....
我甚至因为我的本地git仓库现在认为已更新和最终更改(手动复制更改后)让我做强制更新使用git push -f origin master(我知道,它不应该是合并此类更改的首选方式)。虽然这个命令运行良好,但是做'git checkout master'会抛出另一个错误,说'文件'需要合并 - 你需要先解析你当前的索引'。
这让我想到,Git不知道合并已经发生并使我知道git如何知道我手动合并了更改?
另一件事pn同样的问题,我知道不知何故,我要比较文件存在本地Git存储库(属于分支测试),其版本存在于主存储库中。 问题:如何将两个文件并排放在本地进行比较?
我知道它应该以某种方式进行,以便GIT也知道合并完成,并在本地机器目前文件已更新,合并后的变化,随时可以推掌握
我知道这可能是一个愚蠢的事情我失踪,但严重无法大量搜索
后发现了什么============================= =================
编辑:添加实际的命令是通过问一些成员..谢谢!
[email protected] MINGW64 /d/GitAll/LearnGit (newGitBranch)
$ git checkout master
Switched to branch 'master'
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
[email protected] MINGW64 /d/GitAll/LearnGit (master)
$ git pull origin master
remote: Counting objects: 3, done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
From https://github.com/apexkeen/LearnGit
* branch master -> FETCH_HEAD
8682a7a..bed8390 master -> origin/master
Auto-merging Readme.txt
CONFLICT (content): Merge conflict in Readme.txt
Automatic merge failed; fix conflicts and then commit the result.
[email protected] MINGW64 /d/GitAll/LearnGit (master|MERGING)
$ git merge newGitBranch
error: merge is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use 'git add/rm <file>'
hint: as appropriate to mark resolution and make a commit.
fatal: Exiting because of an unresolved conflict.
[email protected] MINGW64 /d/GitAll/LearnGit (master|MERGING)
$ git config --global --edit
[email protected] MINGW64 /d/GitAll/LearnGit (master|MERGING)
$ git push origin master
To https://github.com/apexkeen/LearnGit.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com/apexkeen/LearnGit.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
[email protected] MINGW64 /d/GitAll/LearnGit (master|MERGING)
$ git push -f origin master
Total 0 (delta 0), reused 0 (delta 0)
To https://github.com/apexkeen/LearnGit.git
+ bed8390...674678e master -> master (forced update)
[email protected] MINGW64 /d/GitAll/LearnGit (master|MERGING)
$ git checkout master
Readme.txt: needs merge
error: you need to resolve your current index first
你可以给实际的'git'命令行和'git'输出吗? – AnoE
对初学者来说似乎是一个很大障碍的事情之一是,你对情况的分析往往是不正确的。事实上,这通常是你首先陷入混乱的原因。这就是为什么我们坚持看到实际的源代码或命令几乎所有问题,尤其是初学者。 –