git-rebase

Git - How to fix “corrupted” interactive rebase?

会有一股神秘感。 提交于 2019-11-30 06:16:13
问题 I managed to create a little mess in my local git repository. I was trying to fix a broken commit by using the following instructions. Before running the "git commit --amend" (and after the git rebase --interactive) I decided that my changes were incorrect and so I executed "git reset HEAD --hard". Not a good idea, I tell you. Now the interactive rebase seems to be "stuck". Git shows the current branch as (|REBASE-m). Every command (cd .., ls, git rebase...) inside my repository gives the

Reverting an interactive git rebase

纵然是瞬间 提交于 2019-11-30 04:35:44
After completing a feature branch, during a git rebase -i I accidentally removed all my commits. I'm not completely sure but I suspect that instead of squashing my commits, I replaced the entire entry with a commit message. http://shafiulazam.com/gitbook/4_interactive_rebasing.html says: The last useful thing that interactive rebase can do is drop commits for you. If instead of choosing 'pick', 'squash' or 'edit' for the commit line, you simply remove the line, it will remove the commit from the history. My question is: is there a way to revert/undo this? VonC If you have just done the rebase,

Git: Cannot rebase because of uncommitted changes

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-30 04:26:40
Git won't let me rebase from anywhere. Cannot rebase: Your index contains uncommitted changes. Please commit or stash them. Following the instructions from this answer: https://stackoverflow.com/a/13694625/618450 $ git update-index -q --ignore-submodules --refresh $ git diff-files --ignore-submodules Both do not produce any output but that one does: $ git diff-index --cached --ignore-submodules HEAD -- :100644 000000 cab819f1e5ed6cc7cff374eecae273e1d6ae6a01 0000000000000000000000000000000000000000 D .idea/codeStyleSettings.xml :100644 000000 2953f353d2c65dd62e36926accb7f645a600b7e0

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

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-30 04:17:20
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-upstream-to=<remote>/<branch> MyBranch It seems like git doesn't expect you to use interactive rebase without

Why do I have to resolve the same conflict over and over?

≡放荡痞女 提交于 2019-11-30 04:12:39
When I do git rebase branch1 in my branch1-local I get conflicts. I solve the conflict, do git add <conflicted-add> and then do git rebase --continue as git asks me to do. After that a new commit is applied. A new conflict shows up. But is the same conflict again! the same file!. I do it again, git add , the git rebase --continue , and then it all repeats again until I do repeat this for each commit being rebased on. Why rebase is having me redo the same conflict resolution over and over again? What you want is git rerere which records conflict resolutions for you. The best introduction to

Need git rebase -Xignore-all-space to preserve my space

China☆狼群 提交于 2019-11-30 03:32:34
问题 I am doing a rebase of a big change, with a lot of whitespace changes. In order for the merge to work at all, I need -Xignore-all-space. According to git --help rebase: ignore-space-change, ignore-all-space, ignore-space-at-eol Treats lines with the indicated type of whitespace change as unchanged for the sake of a three-way merge. Whitespace changes mixed with other changes to a line are not ignored. See also git-diff(1) -b, -w, and --ignore-space-at-eol. o If their version only introduces

Is there some kind of 'git rebase --dry-run', which would notify me of conflicts in advance?

試著忘記壹切 提交于 2019-11-30 02:37:34
I'm trying to script rebasing and my script will take different paths depending on if the rebase results in any conflicts. Is there a way to determine if a rebase would result in conflicts before executing the rebase? At the time of writing (Git v2.6.1 v2.10.0), the git rebase command offers no --dry-run option. There is no way of knowing, before actually attempting a rebase, whether or not you're going to run into conflicts. However, if you run git rebase and hit a conflict, the process will stop and exit with a nonzero status. What you could do is check the exit status of the rebase

Combine or rebase an arbitrarily large number of commits

◇◆丶佛笑我妖孽 提交于 2019-11-30 02:25:12
Let's say my local git log shows: 739b36d3a314483a2d4a14268612cd955c6af9fb a ... c42fff47a257b72ab3fabaa0bcc2be9cd50d5c89 x c4149ba120b30955a9285ed721b795cd2b82dd65 y dce99bcc4b79622d2658208d2371ee490dff7d28 z My remote git log shows: c4149ba120b30955a9285ed721b795cd2b82dd65 y dce99bcc4b79622d2658208d2371ee490dff7d28 z What's the easiest way to get to this ( assuming an arbitrarily large number of local commits ): 527b5810cfd8f45f18ae807af1fe1e54a0312bce a ... x c4149ba120b30955a9285ed721b795cd2b82dd65 y dce99bcc4b79622d2658208d2371ee490dff7d28 z One option is git rebase -i @{u} . I use this

How to retain commit gpg-signature after interactive rebase squashing?

好久不见. 提交于 2019-11-30 01:37:55
When I want to squash some commits by interactive rebase : git rebase -i HEAD~3 And then: pick cbd03e3 Final commit (signed) s f522f5d bla-bla-bla (signed) s 09a7b7c bla-bla (signed) # Rebase c2e142e..09a7b7c onto c2e142e ... The final commit haven't gpg-signature despite that all of those commits have same signature. Is it possible to retain commit gpg-signature after interactive rebase squash? Like Cupcake stated, you can't retain the old signature from the unsquashed commits, but you can sign the new squashed commit if you rebase like this: git rebase --interactive --gpg-sign=myemail

Why does the same conflict reappear when I use git rebase?

ⅰ亾dé卋堺 提交于 2019-11-29 22:53:55
I have read relevant questions about git merge and git rebase on SO, but I still cannot fully understand what is happening under the hood. Here is our branching situation: MASTER------------------------ \ \ \ \----Feature B--- \ \ \-----Feature A----------\---Feature A+B We have 2 feature branches that stem from master at different time, now we want to combine the 2 branches. We want to follow the first rebase then merge practice, but when we rebase Feature A to Feature B, we get conflicts. That's expected, because both features (and master) have changes in the same areas. But the strange