git-rebase

I need to pop up and trash away a “middle” commit in my master branch. How can I do it?

梦想的初衷 提交于 2019-12-17 17:26:30
问题 For example, in the following master branch, I need to trash just the commit af5c7bf16e6f04321f966b4231371b21475bc4da, which is the second due to previous rebase: commit 60b413512e616997c8b929012cf9ca56bf5c9113 Author: Luca G. Soave <luca.soave@gmail.com> Date: Tue Apr 12 23:50:15 2011 +0200 add generic config/initializers/omniauth.example.rb commit af5c7bf16e6f04321f966b4231371b21475bc4da Author: Luca G. Soave <luca.soave@gmail.com> Date: Fri Apr 22 00:15:50 2011 +0200 show github user info

extract multiple directories using git-filter-branch

扶醉桌前 提交于 2019-12-17 17:26:16
问题 I have a big repository which currently contains multiple projects in top level subfolders, say /a , /b , /c , and /d . Now I want to split up that repository into two different repositories: one containing /a and /b and the other containing /c and /d . I am aware of git filter-branch --subdirectory-filter , which is perfect for extracting a single directory, but it seems not to be able to extract multiple directories at once. I am also aware of git filter-branch --prune-empty --tree-filter ,

Git: How to rebase to a specific commit?

心不动则不痛 提交于 2019-12-17 17:24:21
问题 I'd like to rebase to a specific commit, not to a HEAD of the other branch: A --- B --- C master \ \-- D topic to A --- B --- C master \ \-- D topic instead of A --- B --- C master \ \-- D topic How can I achieve that? 回答1: You can avoid using the --onto parameter by making a temp branch on the commit you like and then use rebase in it's simple form: git branch temp master^ git checkout topic git rebase temp git branch -d temp 回答2: You can even take a direct approach: git checkout topic git

Git: How to rebase to a specific commit?

不打扰是莪最后的温柔 提交于 2019-12-17 17:22:17
问题 I'd like to rebase to a specific commit, not to a HEAD of the other branch: A --- B --- C master \ \-- D topic to A --- B --- C master \ \-- D topic instead of A --- B --- C master \ \-- D topic How can I achieve that? 回答1: You can avoid using the --onto parameter by making a temp branch on the commit you like and then use rebase in it's simple form: git branch temp master^ git checkout topic git rebase temp git branch -d temp 回答2: You can even take a direct approach: git checkout topic git

Git rebase --preserve-merges fails

帅比萌擦擦* 提交于 2019-12-17 12:05:49
问题 I have a (large) commit tree that contains several merge commits that I want to rebase to another commit. Doing a normal rebase causes git to ask me to resolve merge conflicts. I didn't want to review each merge, because this would be a lot of work. After finding out about the --preserve-merges option, which is neatly explained here, I thought I found the perfect tool for this task. However, I cannot seem to get it to work properly. I have created a toy example that demonstrates the problem.

Git rebase --preserve-merges fails

こ雲淡風輕ζ 提交于 2019-12-17 12:04:10
问题 I have a (large) commit tree that contains several merge commits that I want to rebase to another commit. Doing a normal rebase causes git to ask me to resolve merge conflicts. I didn't want to review each merge, because this would be a lot of work. After finding out about the --preserve-merges option, which is neatly explained here, I thought I found the perfect tool for this task. However, I cannot seem to get it to work properly. I have created a toy example that demonstrates the problem.

Git rebase fails, 'Your local changes to the following files would be overwritten by merge'. No local changes?

五迷三道 提交于 2019-12-17 10:11:02
问题 Here is my transcript from trying to merge my bugfix branch onto my master branch in preparation to push it upstream. There have been some upstream changes pulled into master since the bugfix branch was created, and it now refuses to rebase. The files it throws errors on are not diffed when opened. no files have been added, removed or renamed. Nothing is ignored and nothing is untracked or staged or unstaged. I'm completely stumped as to why the rebase is failing. I'm on OS X 10.6.6 and git 1

Choose Git merge strategy for specific files (“ours”, “mine”, “theirs”)

爱⌒轻易说出口 提交于 2019-12-17 07:59:29
问题 I am in the middle of rebasing after a git pull --rebase . I have a few files that have merge conflicts. How can I accept "their" changes or "my" changes for specific files? $ git status # Not currently on any branch. # You are currently rebasing. # (fix conflicts and then run "git rebase --continue") # (use "git rebase --skip" to skip this patch) # (use "git rebase --abort" to check out the original branch) # # Changes to be committed: # (use "git reset HEAD <file>..." to unstage) # #

Rebase feature branch onto another feature branch

↘锁芯ラ 提交于 2019-12-17 07:58:07
问题 I have two (private) feature branches that I'm working on. a -- b -- c <-- Master \ \ \ d -- e <-- Branch1 \ f -- g <-- Branch2 After working on these branches a little while I've discovered that I need the changes from Branch2 in Branch1. I'd like to rebase the changes in Branch2 onto Branch1. I'd like to end up with the following: a -- b -- c <-- Master \ d -- e -- f -- g <-- Branch1 I'm pretty sure I need to rebase the second branch onto the first, but I'm not entirely sure about the

Your branch is ahead of 'origin/master' by 3 commits

元气小坏坏 提交于 2019-12-17 06:57:28
问题 I am getting the following when running git status Your branch is ahead of 'origin/master' by 3 commits. I have read on some other post the way to fix this is run git pull --rebase but what exactly is rebase, will I lose data or is this simple way to sync with master? 回答1: You get that message because you made changes in your local master and you didn't push them to remote. You have several ways to "solve" it and it normally depends on how your workflow looks like: In a good workflow your