git-merge

Git: How to properly merge two functional and quite different branches?

做~自己de王妃 提交于 2019-12-03 12:23:55
问题 Imagine a situation where you have two branches of the same project, with one part of the first branch dramatically refactored over the other one. But for a while you need to keep both branches functional, so you are doing bug fixes and crucial feature additions to both of them, sometimes in a not symmetrical way. And at some point there comes a moment when you have to merge refactored branch onto the original one. What is the best technique to use in a situation like this? Is it still

Git merge strategies: spaces make default shows no conflict and bring unexpected results

天涯浪子 提交于 2019-12-03 11:33:35
问题 After many trials, I got this simple test case scenario: a --> b --> c -- (master) \ \ --> d --> b' --> e (branch) Where: b' is a cherry pick of b e is a merge from master . b' was done after c and c has modifications to same files as b ( d probably doesn't matter). e can easily look very unexpected. Let's say all of 'em are dealing with same file " foobar.txt ". This is how the file looks in each commit: // ----------- a foo delme bar // ----------- b foo delme new bar // ----------- c foo

Merge changes from one repo to another with different tree structures

自古美人都是妖i 提交于 2019-12-03 11:22:48
I have two Git repos, foo/master and bar/master: In foo: code_root ->dirA ->dirB -> *some files* In bar: code_root -> *same files as above* Now someone has made changes to *some files* ... how do I get those changes merged into *same files as above* ? When I say "merged" I mean I need the history (commit messages, log hashes etc.) of the deltas to come over as well. You can split the changes out to the subtree level, and then merge with your other branch: # from your foo project git subtree split --prefix=dirA/dirB/ --branch=temp-branch [--onto=<onto-sub-note1>] [<commit-sub-note2>] onto sub

How to undo a git merge squash?

喜夏-厌秋 提交于 2019-12-03 11:00:18
I have just done a git merge --squash feature-branch into my develop branch. The problem is that the above command updated the head without creating a new commit. My intention was to create one single commit to apply to the head of develop . So in short, the log for the develop branch before and after the merge are exactly the same. Is there a way to revert back develop to what it was before the git merge ? Thank you. Solution Based on the comment from Dan D. and the accepted answer below I was able to resolve my problem. See below what I did in case you are in the same boat: 1 - I ran git

git-merge with repository on local filesystem

喜你入骨 提交于 2019-12-03 10:48:46
For some context: I just upgraded Ubuntu which broke my existing gitosis installation (see here: bug #368895 ), and have just reinstalled gitosis from packages. I now want to migrate my whole config and set of repositories from the old gitosis installation (which still exists and can be pulled from but is otherwise broken). I now have two gitosis-admin directories locally, one for each gitosis installation. One has a full history, the other's is empty. I want to pull across this history. Here's what's happening though: me@server:~/gitosis-admin-new$ git merge ../gitosis-admin-old/ fatal: '..

What are these symbols next to “merge mode by recursive” in git merge?

て烟熏妆下的殇ゞ 提交于 2019-12-03 10:42:03
When I use git pull [project name] master to update my core files, I get a bunch of green plus and red minus signals under "merge made by recursive." What are these symbols and what do they mean? Here's a screenshot: Thank you for your help. That is an approximation of how many lines have changed. Pluses are for new content and minuses are for what was taken out. Modifications end up with equal amount of both. Deletions are only minuses and new files are all pluses. Hope this helps! 来源: https://stackoverflow.com/questions/7616742/what-are-these-symbols-next-to-merge-mode-by-recursive-in-git

git - strange branch merge error that I am not sure how to solve

泄露秘密 提交于 2019-12-03 10:39:05
When I git status, I get this error message: # On branch master # Your branch and 'origin/master' have diverged, # and have 1 and 2 different commits each, respectively. # # Untracked files: # (use "git add <file>..." to include in what will be committed) # # .gitignore nothing added to commit but untracked files present (use "git add" to track) So I can't pull or push. When I pull I get this: macoss-MacBook-Pro-10:Marketing owner12$ git pull origin master Password for 'https://genadinik@bitbucket.org': From https://bitbucket.org/genadinik/marketing * branch master -> FETCH_HEAD error: The

GIT 2 or more merge conflicts in a single file - how p4merge handles?

烂漫一生 提交于 2019-12-03 09:09:00
GIT p4merge - 2 or more conflict in same file I have integrated p4merge with GIT and i came across this situation once. I have a file with merge conflicts. The file say foo.c has merge conflicts in 3 different lines of code (the first line with conflict, some lines in the middle with conflicts). When i resolved the first lines of conflict (not other lines of conflict) and saved (using save button on p4merge) i guess it adds the foo.c to index, and when i commit, git allows me to commit without giving me an error or warning to resolve the other conflicting lines in the same file. Is this an

`git stash` during a merge conflict

▼魔方 西西 提交于 2019-12-03 06:44:25
问题 We've done something bad. We ran git stash save during a merge conflict, and now we can't restore our work. Things we've tried: git pull -Xours origin master git stash apply --index And: git pull origin master git stash save --keep-index "merge conflicts" git stash apply stash@{1} Please help! 回答1: The issue seems to be that git stash doesn't save a reference to the branch you were trying to merge in. During a merge, this is stored in a ref named MERGE_HEAD . To fix it and get back to your

How to configure “git pull --ff-only” and “git merge --no-ff”

天涯浪子 提交于 2019-12-03 05:57:44
A typical git workflow for me is to clone a remote repository and use git pull to keep it up-to-date. I don't want merge commits when I pull, so i use the --ff-only option. I also make local branches for feature work. I want to preserve the branch history, so when I merge the local branch back to my local clone, I use the --no-ff option. How can I configure git to use those options by default? Currently my .gitconfig looks like this: [merge] ff = false [pull] ff = only However, git pull (which is really git fetch and git merge) seems to be picking up the merge option and therefore creating