git-merge

can't push to branch after rebase

时间秒杀一切 提交于 2019-12-02 13:50:05
We use git and have a master branch and developer branches. I need to add a new feature and then rebase the commits to master, then push master to CI server. The problem is that if I have conflicts during rebase I cannot push to my remote developer branch (on Github) after the rebase is complete, until I pull my remote branch. This causes duplicate commits. When there are no conflicts, works as expected. question: after rebase and conflict resolution, how do I sync up my local and remote developer branches without creating duplicate commits Setup: // master branch is the main branch git

git merge overwrites contents

£可爱£侵袭症+ 提交于 2019-12-02 09:34:37
Here is my situation: I have two feature branches A & B. I want to combine these two branches. I did the following: Create a new branch C branching off from A Checkout the new branch C run git merge B from command line I expect both the branches combined. If there are conflicting changes to the same files the command should raise a merge conflict. But in actual, there is a same file which has different contents in branches A and B but there was no merge conflict reported. Instead, the contents of the file from branch A are overwritten by the contents of the file from branch B. I have no clue

Git undo pushed merge and delete its history

99封情书 提交于 2019-12-02 09:18:18
I made an accidental merge to master and pushed it, now master has all the commits from dev. I want to revert the commits from master and delete its history without changing dev. How can I do that? The last commit can be removed with: git reset --hard HEAD^ . Sometimes there might be situations, when you need to remove a commit from the "middle" of branch. Here comes to the rescue interactive rebase: git rebase -i <commit>^ . You just need to drop an unwanted commit (it should appear at the top of the list). If the changes you undone were available in remote, they also should be removed from

What is the right way to commit/push when there are conflicts in Git or TortoiseGit?

久未见 提交于 2019-12-02 07:36:18
问题 We are using git and the merge workflow. We have lot of git newbies (including me) who either have an SVN or CVS background, or no version control background at all. Here is a frequent issue we are running into. Many of the team members were using TortoiseGit. Merge conflicts happened fairly often because of concurrent changes - or since they did not pull every day. One user would do a pull, have a merge conflict, resolve the merge conflict, and then look at the list of files to be committed

What is the right way to commit/push when there are conflicts in Git or TortoiseGit?

半城伤御伤魂 提交于 2019-12-02 06:48:20
We are using git and the merge workflow. We have lot of git newbies (including me) who either have an SVN or CVS background, or no version control background at all. Here is a frequent issue we are running into. Many of the team members were using TortoiseGit. Merge conflicts happened fairly often because of concurrent changes - or since they did not pull every day. One user would do a pull, have a merge conflict, resolve the merge conflict, and then look at the list of files to be committed back. But then the file list shows a lot of files, though there were merge conflicts involved in only a

How to commit & push selected files but not all in Git

一个人想着一个人 提交于 2019-12-01 23:44:37
问题 I have a git repo with two branches: develop and master . I work mostly at develop and when files are ready (sometimes not so sticky to this affirmation) I merge them to master branch to put them on production. Take a look to this pic: All that files comes from develop branch and was merged but I only want to commit and push RepresentativeRestController.php but any time I do right click => commit all of them are included on the commit. How I get rid, temporary since they will be added later,

How to commit & push selected files but not all in Git

左心房为你撑大大i 提交于 2019-12-01 21:20:14
I have a git repo with two branches: develop and master . I work mostly at develop and when files are ready (sometimes not so sticky to this affirmation) I merge them to master branch to put them on production. Take a look to this pic: All that files comes from develop branch and was merged but I only want to commit and push RepresentativeRestController.php but any time I do right click => commit all of them are included on the commit. How I get rid, temporary since they will be added later, of the ones I don't want to be included on the commit? I use Smartgit as a GUI client for Bitbucket

How does --no-ff merge break bisect and blame?

百般思念 提交于 2019-12-01 19:45:54
Understanding the Git Workflow article says, So you add a new rule: “When you merge in your feature branch, use –no-ff to force a new commit.” This gets the job done, and you move on. Then one day you discover a critical bug in production, and you need to track down when it was introduced. You run bisect but keep landing on checkpoint commits. You give up and investigate by hand. You narrow the bug to a single file. You run blame to see how it changed in the last 48 hours. You know it’s impossible, but blame reports the file hasn’t been touched in weeks. It turns out blame reports changes for

How do contents of git index evolve during a merge (and what's in the index after a failed merge)?

别来无恙 提交于 2019-12-01 18:09:33
I have a fuzzy idea of what the git index contains as one does git-add s and git-commit s, but I don't have a clue of what happens to these contents when one does a git-merge . I'm particularly interested in learning what the index holds when a merge fails (e.g. due to some conflict). For any given path, there are up to four "version numbers" in the index, numbered 0 (zero) through 3. I'll call them "slots" as if they were actually there for every entry, and then easily indexed (this makes them easier to think about), although actually extra versions are introduced dynamically only when needed

.gitattributes: merge=ours strategy vs. fast-forward merging

巧了我就是萌 提交于 2019-12-01 11:01:23
If I am in such a git situation: * da6a750 (A) Further in A, okay for merging back into master * bf27b58 Merge branch 'master' into A |\ | * 86294d1 (HEAD -> master) Development on master * | abe6b8a Welcome to branch A |/ * 589517c First commit On the master branch, three files: ./development : development on master initial ./specific : master branch ./.gitattributes : specific merge=ours On A branch, three files as well: ./development : development on master initial development in A further in A, okay for merging into master ./specific : Welcome to branch A ./.gitattributes : specific merge