我是新來的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
對初學者來說似乎是一個很大障礙的事情之一是,你對情況的分析往往是不正確的。事實上,這通常是你首先陷入混亂的原因。這就是爲什麼我們堅持看到實際的源代碼或命令幾乎所有問題,尤其是初學者。 –