What’s the difference between ‘git merge’ and ‘git rebase’?

What’s the difference between git merge and git rebase? 7 s 7 Suppose originally there were 3 commits, A,B,C: Then developer Dan created commit D, and developer Ed created commit E: Obviously, this conflict should be resolved somehow. For this, there are 2 ways: MERGE: Both commits D and E are still here, but we … Read more

Merging dictionaries in C#

What’s the best way to merge 2 or more dictionaries (Dictionary<T1,T2>) in C#? (3.0 features like LINQ are fine). I’m thinking of a method signature along the lines of: public static Dictionary<TKey,TValue> Merge<TKey,TValue>(Dictionary<TKey,TValue>[] dictionaries); or public static Dictionary<TKey,TValue> Merge<TKey,TValue>(IEnumerable<Dictionary<TKey,TValue>> dictionaries); EDIT: Got a cool solution from JaredPar and Jon Skeet, but I was thinking of … Read more

The following untracked working tree files would be overwritten by merge, but I don’t care

On my branch I had some files in .gitignore On a different branch those files are not. I want to merge the different branch into mine, and I don’t care if those files are no longer ignored or not. Unfortunately I get this: The following untracked working tree files would be overwritten by merge How … Read more

git cherry-pick says “…38c74d is a merge but no -m option was given”

I made some changes in my master branch and want to bring those upstream. When I cherry-pick the following commits. However, I get stuck on fd9f578 where git says: $ git cherry-pick fd9f578 fatal: Commit fd9f57850f6b94b7906e5bbe51a0d75bf638c74d is a merge but no -m option was given. What is git trying to tell me and is cherry-pick … Read more

JPA EntityManager: Why use persist() over merge()?

EntityManager.merge() can insert new objects and update existing ones. Why would one want to use persist() (which can only create new objects)? 15 s 15 Either way will add an entity to a PersistenceContext, the difference is in what you do with the entity afterwards. Persist takes an entity instance, adds it to the context … Read more