git-rebase

How to clean up unused side-branches in your commit trees?

北战南征 提交于 2019-12-07 00:03:05
问题 How would you clean up unused side-branches in your commit trees (not real git branches)? Example (tree, fake-commit-hash, commit message, optional [pointers]): * 0001 last commit [master] [origin/master] [HEAD] | * 0002 old, unused merge |/| * | 0003 some remote commits * | 0004 another commit from remote | * 0005 old, unused commits |/ * 0006 old tree The path 0001, 0003, 0004, 0006 should stay untouched, but the commits 0002 and 0005 are not useful and aren't doing any good. How do you

I can't git rebase --interactive anymore

谁都会走 提交于 2019-12-06 23:30:02
问题 I'm having a serious problem trying to do git rebase --interactive on my repo. I get the cryptic error fatal: ref HEAD is not a symbolic ref , and my rebase ceases to function. I must git rebase --abort to get back to a good state. Here are the output(s) I receive: https://gist.github.com/d38f1e2d2ec9bc480b6f What I've been told in the past is that this is due to the fact that I'm in "detached HEAD" mode, but how would I have gotten into the rebase in the first place if I was in that mode? I

Why does git show a conflict between two apparently identical added files?

僤鯓⒐⒋嵵緔 提交于 2019-12-06 20:50:03
问题 I have a project that was started in TFS, then moved to Git. Unfortunately, the guy who moved it to Git just checked in the current files instead of using git-tfs. I'm trying to rebase his new commits in Git on top of the commits I pulled from TFS using git-tfs. To do this, I'm simply rebasing his commits on top of the git-tfs commits. (I realize this will mess up remote Git branches, but we're a small team and it'll be OK. I've also tried cherry-picking instead but I hit the same problem.)

Routinely sync a branch to master using git rebase

会有一股神秘感。 提交于 2019-12-06 11:07:41
I have a Git repository with a branch that hardly ever changes (nobody else is contributing to it). It is basically the master branch with some code and files stripped out. Having this branch around makes it easy for me to package up a leaner version of my project without having to strip out the code and files manually every time. I have been using git rebase to keep this branch up to date with the master but I always get this warning when I try to push the branch after rebasing: To prevent you from losing history, non-fast-forward updates were rejected Merge the remote changes before pushing

Resolve git rebase conflicts the same way they were resolved previously

Deadly 提交于 2019-12-06 10:59:22
问题 I've decided to retrospectively commit a history, that was never in Git, from an other old version control system. So I've created an orphan branch "newroot", and imported commits from the other version control system to it. Following question Insert a commit before the root commit in Git? The "newroot" branch ended up with files exactly matching the root commit of the "master" branch. Now I want to rebase the "master" branch onto the "newroot" orphan branch, like: git rebase --onto newroot -

git rebase and sharing a feature branch?

﹥>﹥吖頭↗ 提交于 2019-12-06 09:55:39
Based on this: https://www.atlassian.com/git/tutorials/rewriting-history/git-rebase git rebase will make it possible to maintain a linear history (a merge "always" results in a fast-forward) But if I want to enforce a linear history and require developers to always rebase their feature branches on latest master will that not result in collaboration/sharing feature branches going out the window? See: Don't rebase public history so is it possible to enforce linear history using git rebase and at the same time allow multiple developers to contribute to the same feature branch? Or will git rebase

git rebase interactive already pushed commits

孤者浪人 提交于 2019-12-06 09:44:32
Recently I had a lot of success rebasing a local-only repository while changing commit messages and after that only the commit messages had been changed but the history itself hasn't. Now I have my repositories - remotely and locally. I made several commits on several branches and already pushed them. Due some reasons I need to change some commit masseages over several branches and tried to use rebase interactive like before. But the commits appeared at the end of the current checked out branch. (I know how to and I had reset my repositories to the state before rebasing.) After some reading I

Rebase entire git branch onto orphan branch while keeping commit tree intact

允我心安 提交于 2019-12-06 07:28:08
I have a repo in which I have two branches, master and master-old , which was created as an orphan branch. Now I want to rebase the entirety of master onto master-old , but the tree of each commit should stay unchanged, i.e. the working copies of each commit on master and master-old should look exactly the same way before and after the rebase. Current state ------------- A - B - C - D <--- master E - F - G - H <--- master-old Desired state ------------- E'- F'- G'- H'- A'- B'- C'- D' <--- master I tried to accomplish this using git rebase --onto master-old --root . The problem is, that in both

git rebase implementation details

六月ゝ 毕业季﹏ 提交于 2019-12-06 06:26:15
I am trying to figure out the working mechanism of git-rebase . Documentation provides information about what git-rebase does, but doesn't comment on how it does? I have looked into the source code , worked out some test cases and so far understand following: 1. Git maintains the state of rebase in .git/rebase-apply (with files like patch, final-commit, head-name etc) 2. Git uses git-format-patch to create all necessary patch files (which are inside rebase-apply) 3. Git uses git-am to apply those patches one by one I think I am missing quite a lot of details. Where can I find the

Empty commits removed after interactive rebase, even though --keep-empty is used

孤街醉人 提交于 2019-12-06 04:19:44
问题 I have some trouble using the --keep-empty option of git rebase , and I'm not sure whether I'm misunderstanding what this option does, or there's a bug. Here is a minimal example: Setup Create a new Git repository and an initial, unrelated commit. $ git init $ echo something >base.txt $ git add base.txt $ git commit -m 'some base commit to not run into the root corner case' Create a new commit which adds two new files. $ echo A >a.txt; echo B >b.txt $ git add a.txt b.txt $ git commit -m 'add