rebase

How to get “their” changes in the middle of conflicting Git rebase?

独自空忆成欢 提交于 2019-11-28 13:08:55
问题 I have conflicting branches, branch2 branched from branch1. Let's say when rebasing branch2 on current branch1 , while resolving conflicts, I decide to take some (not all) of "their" (i.e. branch1 ) files as-is. How do I do that? I tried: git checkout branch1:foo/bar.java fatal: reference is not a tree: TS-modules-tmp:foo/bar.java git checkout refs/heads/branch1:foo/bar.java fatal: reference is not a tree: refs/heads/TS-modules-tmp:foo/bar.java 回答1: You want to use: git checkout --ours foo

Merge two Git repos and keep the history

大憨熊 提交于 2019-11-28 06:32:05
I want to extend on another question I had: Merge two Git repositories and keep the master history I have succeeded in merging 2 different repo's into one repo. I needed a rebase to do this successfully. The master is correct, but I also want to keep the merge history . Is this possible? I have 2 repositories: https://github.com/DimitriDewaele/RepoA https://github.com/DimitriDewaele/RepoB This is the result after rebasing. The times of the top repo are the rebase-time. The original date is lost! https://github.com/DimitriDewaele/RepoMerged This is how I did it: # Assume the current directory

git - setting a commit's parent without rebase

江枫思渺然 提交于 2019-11-28 04:33:01
I used git-svn to create a git mirror of an SVN repository. The structure inside the SVN was a little off-standard, so git created a branch that has no common commit with the master branch. A---B---C topic D---E---F---G master I know that commit A is based off commit E and I'm pretty positive that I've fixed the issues causing git not to recognize that fact (using filter-branch ). What I want to do is re-attach topic to the master branch, setting E as the parent of A : A---B---C topic / D---E---F---G master git-rebase doesn't seem to work for me because the diff for commit A lists the creation

git: How to automate interactive rebase / replace it by equivalent git commands

天大地大妈咪最大 提交于 2019-11-28 03:53:49
问题 I need to automate a interactive rebase or replace it by other commands. Just let me explain my current situation: In an svn->git transition i need to rebase the newly created git repository to fix a "history cut-offs" made during SVN. Here is my manual workflow to fix the problem. branchNEW: containing history from SOMEDAY until now branchOLD: containing history from past to SOMEDAY EDIT or as ascii: branchNEW: Y - Z branchOLD: W - X Both branches have no common commits. The basic idea now

How do I reduce the size of a bloated Git repo by non-interactively squashing all commits except for the most recent ones?

岁酱吖の 提交于 2019-11-28 03:43:24
问题 My Git repo has hundreds of gigabytes of data, say, database backups, so I'm trying to remove old, outdated backups, because they're making everything larger and slower. So I naturally need something that's fast; the faster, the better. How do I squash (or just plain remove) all commits except for the most recent ones, and do so without having to manually squash each one in an interactive rebase? Specifically, I don't want to have to use git rebase -i --root For example, I have these commits:

git rebase interactive: squash merge commits together

蹲街弑〆低调 提交于 2019-11-28 03:08:20
I wanted to have a simple solution to squash two merge commits together during an interactive rebase. My repository looks like: X --- Y --------- M1 -------- M2 (my-feature) / / / / / / a --- b --- c --- d --- e --- f (stable) That is, I have a my-feature branch that has been merged twice recently, with no real commits in between. I don't just want to rebase the my-feature branch since it is a published branch of its own, I just want to squash together the last two merge commits into one (haven't published those commits yet) X --- Y ---- M (my-feature) / / / / a --- ... -- f (stable) I tried:

Resolving a 'both added' merge conflict in git?

别等时光非礼了梦想. 提交于 2019-11-28 03:05:08
I'm rebasing in git, and one conflict I get is 'both added' - that is, exactly the same filename has been added independently in my branch, and in the branch I'm rebasing on. git status tells me: # Unmerged paths: # (use "git reset HEAD <file>..." to unstage) # (use "git add/rm <file>..." as appropriate to mark resolution) # # both added: src/MyFile.cs My question is, how do I resolve this? Must I use a merge tool or is there a way I can do it just from the commandline? If I git rm src/MyFile.cs , how does git know which file version I want to remove and which I want to keep? CB Bailey If you

Git rebase: conflicts keep blocking progress

本秂侑毒 提交于 2019-11-28 02:49:38
I have a git branch (called v4), that was made from master just yesterday. There were a couple of changes to master, that I want to get into v4. So, in v4, I tried to do a rebase from master, and one file keeps screwing things up: a one-line text file, that contains the version number. This file is app/views/common/version.txt , which before rebasing contains this text: v1.4-alpha-02 Here's what I'm doing: > git rebase master First, rewinding head to replay your work on top of it... Applying: new version, new branch error: patch failed: app/views/common/version.txt:1 error: app/views/common

How does squashing, rebasing, reset --soft affect github contributions page?

廉价感情. 提交于 2019-11-28 01:55:45
问题 For some projects I do or work on sometimes it is usually best that we squash/rebase all changes into a single commit. However, I was wondering how this affects the contributions page on github. For example, if I spent 2 months pushing changes to a project I created and then after 2 months decided to rebase it to one single commit, would github remove all the contribution cubes on the map for the past two months? 回答1: I saw this still here so I figured I might as well answer the question. So

How do you get a lost “autostash” commit from `git rebase --autostash`

放肆的年华 提交于 2019-11-28 01:44:17
问题 When using git rebase --autostash , git automatically creates an "autostash" commit, and will re-apply it after a successful rebase. But in case the rebasing is aborted (e.g. by using :cq in Vim when it's an interactive rebase), the autostash-commit might end up as a dangling commit. Git 2.9.0 回答1: Git 2.10 (Q3 2016) should avoid that issue entirely. See commit 33ba9c6 (29 Jun 2016) by Patrick Steinhardt (pks-t). (Merged by Junio C Hamano -- gitster -- in commit 5eb1e9f, 13 Jul 2016) rebase