rebase

Git squash all commits in branch without conflicting

老子叫甜甜 提交于 2019-12-03 02:20:27
问题 A common development workflow for us is to checkout branch b , commit a bunch to it, then squash all those commits into one (still on b ). However, during the rebase -i process to squash all the commits, there are frequently conflicts at multiple steps. I essentially want to alter the branch into one commit that represents the state of the repository at the time of the final commit on b I've done some searching but I haven't found exactly what I'm looking for. I don't want to merge --squash

Change root of a branch in git

南楼画角 提交于 2019-12-03 01:58:50
I'm using git and want to change the base of an exiting branch. This is caused by a deployment system, which pulls this explicit branch into my production environment. When planning my releases, I create a tag every time I want to go live. But my branch has special changes too, so git reset --hard v1.0 won't work. Here a small example. I want this C---D---E deploy / A---B---F---G master \ v1.0 to become this C---D---E deploy / A---B---F---G---H---I---J---K master \ \ v1.0 v1.1 Maybe git rebase is what I am looking for, but the man pages don't help me. Thanks for your replies! git rebase should

git pull *after* git rebase?

时光怂恿深爱的人放手 提交于 2019-12-03 01:53:49
问题 I have a feature branch, and a master branch. Master branch has evolved and I mean to have those updates to diverging as little as possible from master branch. So I git pull in both branches, git checkout feature/branch and finally git rebase master . Now here I either expect everything to work smoothly or conflicts showing up that I need to resolve before continuing rebase until all master commits are re-applied successfully on feature branch. Now what really happened in my case is something

Git rebase, skip merge-commits

元气小坏坏 提交于 2019-12-03 01:50:51
Starting with hack---F1----M1----F2 (feature) / / C1-----C2----C3 (master) I would like to end up with hack---F1----M1----F2 (feature) / / C1-----C2----C3---F1'---F2' (master) So far the best I have is git checkout feature git checkout -b temp git rebase -i --onto master hack temp * Big drawback: manually remove the merged-in C2 and C3 from list of commits * git checkout master git merge temp git branch -d temp I hope someone can answer even though this is a dubious workflow. jub0bs Simple case If the state of your repo is hack---F1----M1----F2 [feature] / / C1-----C2----C3 [master] and you

Redoing Commit History in GIT Without Rebase

南楼画角 提交于 2019-12-03 01:28:45
Since asking my last question which turned out to be about rebasing with GIT , I have decided that I don't want to rebase at all. Instead I want to: Branch Work work work, checking in and pushing at all times Throw out all of those commits and pretend they never happened (so one clean commit at the end of work) I do this currently by copying the files to a new directory and then copying them back in to a new branch (branched at the same point as my working branch), and then merging that into master or wherever. Is this just plain bad and why? More important: Is there a better/GIT way to do

When would one need git-rebase?

那年仲夏 提交于 2019-12-02 22:42:35
Everytime I read the git-rebase documentation, I get lost. It feels to me like a kind of a low-level operation (read: dark magic). Quoting the docs: Assume the following history exists and the current branch is "topic": A---B---C topic / D---E---F---G master From this point, the result of either of the following commands: git rebase master git rebase master topic would be: A'--B'--C' topic / D---E---F---G master The question is: Why would anyone want to do such a thing? For one thing, it seems to "re-write" history, as if the branch started at a different point; essentially the commit history

git rebase branch with all subbranches

浪子不回头ぞ 提交于 2019-12-02 22:41:15
is it possible to rebase a branch with all it's subbranches in git? i often use branches as quick/mutable tags to mark certain commits. * master * * featureA-finished * * origin/master now i want to rebase -i master onto origin/master , to change/reword the commit featureA-finished^ after git rebase -i --onto origin/master origin/master master , i basically want the history to be: * master * * featureA-finished * (changed/reworded) * origin/master but what i get is: * master * * (same changeset as featureA-finished) * (changed/reworded) | * featureA-finished |.* (original commit i wanted to

How can I rebase a commit made by another author without adding myself as the committer?

随声附和 提交于 2019-12-02 21:17:24
Normally, when you rebase another author's commit with git, git adds a Commit: header with your name and email address. I have a situation where I don't want this to happen. I want the rebased commit to end up with the same SHA1 as it would have if the original author had done the equivalent rebase him/herself. Is this possible? All git commits have a committer field internally; you can see this by typing git cat-file commit HEAD immediately after committing something. As such you cannot erase it; you can only make it equal to the author field. That said, you might be seeing git porcelain

git: Merge Branches but Keep Commit History

佐手、 提交于 2019-12-02 20:49:36
In my git workflow we have one main repository and one branch, master. Everyone pulls from remote master and everyone pushes to remote master. I want to work in my own branch while I prepare a feature. So far my history is something like this: git pull --rebase git checkout -b new_feature <make some commits> git checkout master git pull --rebase Now I want to merge the branch and here's what I need: No merge commits in my local master branch. All commits made into my new_feature branch merged into master as if I had made them in master. All merged commits to be merged somewhere on top of my

How can I pull all remote changes with rebase instead of merge?

你离开我真会死。 提交于 2019-12-02 20:27:14
I can pull changes using git pull , but it merges my local commits. Is there a git rebase equivalent with which I can pull in remote changes? Yes you can git pull --rebase . You can also set that to be the default pull behaviour when you track a branch with git config branch.autosetuprebase always . Replace "always" with "remote" or "local" if you want to do it to those specific types of branches that you're tracking. Now all you have to do is git pull . If for some reason you want to do a merge, you can do git pull --no-rebase . Hope this helps. UPDATE: see comments below for how to do this