rebase

How do I rebase a chain of local git branches?

谁都会走 提交于 2019-11-29 16:55:29
问题 Suppose I have a chain of local git branches, like this: master branch1 branch2 | | | o----o----o----A----B----C----D I pull in an upstream change onto the master branch: branch1 branch2 | | A----B----C----D / o----o----o----o | master Now I rebase branch1, giving me this: branch2 | A----B----C----D / o----o----o----o----A'---B' | | master branch1 Note that because of rebasing branch1, commits A and B have been rewritten as A' and B'. Here's my problem: now I want to rebase branch2. The

How to rebase after squashing commits in the original branch?

Deadly 提交于 2019-11-29 12:03:30
问题 I have A--B--C master \ D branch0 Then I squash B and C into B' . How do I rebase branch0 such that it looks like this: A--B' master \ D branch0 回答1: Use the --onto argument to git rebase, which changes the baseline that git replays work on. git checkout branch0 At this state you should still see C in your git history. git rebase --onto B' C This translates to: Take all commits in my current branch since commit C (In your case that's just D ) and play back on top of B' You can also use the

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-29 10:14:40
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: A .. B .. C ... ... H .. I .. J .. K .. L What I want is this (squashing everything in between A and

git pull --rebase upstream & git push origin rejects non-fast-forward?

為{幸葍}努か 提交于 2019-11-29 09:24:06
问题 I've implemented classic OSS maintainer/contributor git workflow for a company project on github, however one edge case produces some weird results that I'm not sure how to get around. Lets say there is a typical project that I forked and added upstream remote to keep it up to date. git clone git@github.com:kozhevnikov/<project>.git git remote add upstream git@github.com:<company>/<project>.git For the purposes of this example this fork is behind by a few commits. git reset --hard HEAD~5 &&

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

白昼怎懂夜的黑 提交于 2019-11-29 08:42:12
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? I saw this still here so I figured I might as well answer the question. So the answer is YES. It will remove the contributions from the graph. It won't do it right away because

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

跟風遠走 提交于 2019-11-29 07:55:49
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 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 -i : restore autostash on abort When we abort an interactive rebase we do so by calling die_abort , which

how to use git rebase to clean up a convoluted history

戏子无情 提交于 2019-11-29 06:47:56
After working for several weeks with a half dozen different branches and merges, on both my laptop and work and my desktop at home, my history has gotten a bit convoluted. For example, I just did a fetch, then merged master with origin/master. Now, when I do git show-branches, the output looks like this: ! [login] Changed domain name. ! [master] Merge remote branch 'origin/master' ! [migrate-1.9] Migrating to 1.9.1 on Heroku ! [rebase-master] Merge remote branch 'origin/master' ---- - - [master] Merge remote branch 'origin/master' + + [master^2] A bit of re-arranging and cleanup. - - [master^2

What's the replacement for REBASE.EXE?

♀尐吖头ヾ 提交于 2019-11-29 04:02:20
I have a need to rebase the group of DLL files that I install with my program, because it's a 32-bit program and the address space is just too fragmented right now. Also there is the problem of the entirety of the DLLs being demand-paged into RAM on a cold boot so that the loader can rebase them, due to base address conflicts with some DLLs. Some DLLs are ones we have compiled; others are from 3rd parties. What I would like to do is have a tool rebase a given set of DLLs so that the group of DLLs occupies a contiguous block of memory. This tool would then be run just prior to the compilation

How do I use Git's interactive rebase with a local-only repository (no remote / origin)?

99封情书 提交于 2019-11-29 02:13:32
问题 I use git as a local source control system mostly for history and diff tracking. I still want to use rebase to do fixup / squash on WIP commits that I will make periodically. When I try to do git rebase -i though, I get the following: There is no tracking information for the current branch. Please specify which branch you want to rebase against. See git-rebase(1) for details git rebase <branch> If you wish to set tracking information for this branch you can do so with: git branch --set

Git interactive rebase without opening the editor

半世苍凉 提交于 2019-11-29 01:16:26
Git allows certain commands to create or modify commits without opening the editor first, for example: git commit --amend --no-edit git commit --fixup=HEAD^ I have set rebase.autosquash to true , so that the todo list for an interactive rebase is automatically reordered. Is there a way to immediately perform the rebase, without opening the editor first, something like: git rebase -i --no-edit HEAD~3 TL;DR answer: GIT_SEQUENCE_EDITOR=: git rebase -i HEAD~3 You can't stop git rebase --interactive from running the "sequence editor" (that's the edit command on the "sequence file" containing the