rebase

alternative to rebasing pushed commits

梦想的初衷 提交于 2019-12-10 11:29:26
问题 The GitHub documentation recommends against rebasing commits that have been pushed publicly. We have two branches master and dev . I have made a change to master for a hotfix that I would like to take across to dev , dev itself is fairly far ahead of master . In this case the hotfix is to 2 files and is only a 1 line change in each. What is the easiest way to get this to the dev branch without confusing things terribly? 回答1: If the hotfix is the only thing in master that isn't in dev you

What does it mean when git pull causes a conflict but git pull --rebase doesn't?

雨燕双飞 提交于 2019-12-10 10:59:02
问题 I'm pulling from a repository that only I have access to. As far as I know, I've only pushed to it from one repository. A couple of times, I've tried pushing to it and gotten this: To jbaker@192.168.2.216:tsched_dev.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'jbaker@192.168.2.216:tsched_dev.git' To prevent you from losing history, non-fast-forward updates were rejected Merge the remote changes before pushing again. See the 'Note about fast-forwards

git rebase -i — why is it changing commit hashes?

一曲冷凌霜 提交于 2019-12-10 03:01:11
问题 So I'm more or less familiar with how rebasing works, but up until recently I usually just did a git rebase -i HEAD~20 , and modified whatever needed to be modified. I was surprised to learn that this will modify the hashes of all 20 commits, even if the only action I take is to squash the last two. I'm not sure what causes the hash change for the other 18 commits though, since neither their parents, neither their contents change... Or does it? Maybe a timestamp? Also is there a way to

Interactive rebase after merging/other commits interleaving mine

断了今生、忘了曾经 提交于 2019-12-10 01:50:05
问题 My typical git workflow is to make a feature branch off our master branch, make small commits, while periodically merging from master along the way to keep up. I then open a pull request on github and when it's accepted I'll delete the branch. I'd like to interactively rebase more but when I do I'll encounter merge commits and other people's commits interleaved with my own. I'm not sure how/if I can squash those commits or group/squash mine alone? For instance, my git log for my branch might

How to rebase my feature branch to development branch in git with least possible conflicts?

微笑、不失礼 提交于 2019-12-10 01:36:46
问题 I have my feature branch which has exceeded around 30 or more commits. Meanwhile in development branch few other features have been pushed from other developers. Therefore, Everytime a new feature is published on development, I am asked to: Rebase development branch onto my feature branch Resolve conflicts if any Continue developing in your feature branch The problem The second step is the chicken's neck here. On rebasing it gives me conflicts for every commit of that branch. This is really

During a git rebase, how can I keep the original and discard changes?

大憨熊 提交于 2019-12-10 00:45:02
问题 I am doing a rebase and have come to a file with conflicts, but these conflicts are basically impossible to resolve. The best way to deal with the situation would be to tell git to ignore the changes and keep the original. I can then go back and re-edit the file to make the changes. How can I do this? 回答1: If you have encountered a merge conflict you can do this git checkout --ours file or the other way round git checkout --theirs file 来源: https://stackoverflow.com/questions/8566272/during-a

How to run tests for all commits during a rebase

試著忘記壹切 提交于 2019-12-09 15:54:05
问题 I have a feature branch with plenty of commits. A---B---C master \ \-B'---C'---D'...---Z' feature I am working on feature but another developer has created commits B and C . Now I want to rebase feature on commit C , but I and/or automerge introduced errors during the rebase. My project has very good test coverage and I can run the tests from console using ant rebuild test , and now I want git to tell me which commit is the first commit that breaks my test so I can fix that commit. How can I

Git workflow and Gerrit

我只是一个虾纸丫 提交于 2019-12-09 08:21:34
问题 I am trying to implement a 'git-flow' kind of workflow using Gerrit but I can't seem to figure out the last piece of the puzzle. There are two preconditions to my problem: Gerrit will only perform merging to one branch I do not allow merge commits to be pushed to Gerrit. The merging has to be done by Gerrit after the changes are approved What I want to solve is the following. Consider this git situation: Master 0 \ \ Develop 0-----0-----0-----0 There is a master branch with one commit and a

Why isn't 'git bisect' branch aware?

喜欢而已 提交于 2019-12-09 07:51:44
问题 I'm trying to find the source of a bug that's come up since a commit in the past day on a long lived branch (which will be released much much later) called feature-x . There's a bug though. I find behavior that I don't expect from my script which might have been introduced in any of the commit's up till now, specifically because features of master are used heavily in feature-x, but less so on Master itself. To test this behavior, I have to run my script, dependent.pl. But when bisect jumps

Git rebase one branch on top of another branch

主宰稳场 提交于 2019-12-09 04:05:22
问题 In my git repo, I have a Master branch. One of the remote devs created a branch Branch1 and had a bunch of commits on it. I branched from Branch1 , creating a new branch called Branch2 ( git checkout -b Branch2 Branch1 ) such that Branch2 head was on the last commit added to Branch1 :(Looks like this) Master--- \ Branch1--commit1--commit2 \ Branch2 (my local branch) Branch1 has had a number of changes. The other dev squashed his commits and then added a few more commits. Meanwhile, ive had a