FAQ Database Discussion Community


How to split a branch in two with Git?

git,split,branch,rebase,cut
I've made a feature branch from master and then realize at some point that it will be better to start a new branch from this branch. So, how to split a branch in two at a specific commit ? Let me explain with this little schema: I have this: master...

How do I cleanup Git Commits messed up by Rebase

git,commit,rebase,undo
Here's what the commit history looked like before I mucked it up: A B C [master] \ D E F G H I [refactor] Here's what my current commit history looks like: A --------------- E B C F D [master branch] \ B C D E F G H I...

git - exclude commits when rebasing

git,git-merge,rebase,git-rebase
I have recently merged a feature that was not ready to go into master. Without realizing it I rebased the bad master into another branch that was good. But now I am not sure how to pull those bad commits out of my other story. HERE is my git log...

git - squash before rebasing

git,rebase,git-rebase
I have two branches: master and test-branch (which is branched off of master). My work has looked something like the following: git checkout master git checkout -b test-branch make a bunch of changes and commit them make more changes and do another commit git checkout master git pull -> out...

How can I rebase as one commit using Git

git,rebase,squash
My history looks somewhat like this but times 10: i - j - e'- k - h'- l - m feature-branch / a - b - c - d - e - f - g - h master (the apostrophes meaning cherry picks) I want to rebase to this: i...

How to increase column width when performing text mode merge with ClearCase?

command-line,merge,clearcase,rebase,column-width
For automation/scripting purposes I rebase my ClearCase snapshot view on the UNIX command line using: cleartool rebase -recommended -complete Sometimes, while this command runs, even if my snapshot view does not contain any changes at all, I get prompted for manual input to solve some merge conflicts. E.g. "Do you...

Git merge to a old point in history

git,merge,rebase
I have a small repository, which I try to keep the more linear as possible (only one main branch). At some point in time I introduced breaking change in my code, put a tag at that point and continue. Now, after a lot of commits and push and pull, I...

understanding and using git rebase

git,github,rebase
I have read a lot on git rebase for months now. But, I am still not comfortable using it in my day to day development work. Just the way I understand merge in version control tools, is there a way I can understand rebase in git and use it to...

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

git,branch,rebase,git-rebase,remote-branch
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...

How to use interactive rebase on the first (root) commit of a branch?

git,rebase,squash
If I'm in the following situation, $ git log --oneline: * abcdef b * 123456 a I know I can always run $ git reset HEAD~ $ git commit --amend However, I tried to run $ git rebase -i HEAD~2 but I got fatal: Needed a single revision invalid upstream...

Git pull --rebase when push

git,push,rebase,pull
I'd like to know if it would be possible with git to auto pull --rebase when doing git push ? I mean if git push is rejected, automatically do a git pull --rebase and then git push again so I don't need to do that manually each time someone push...

How do I fix a Corrupted csproj file?

xml,git,visual-studio,rebase,csproj
I'm in a group working on a project, and was about to Rebase my branch with the new updates from master-branch using git. When rebase started, it suddenly breaks down and gives me this error message: The project file could not be loaded. Name cannot begin with the '<' character,...

How can I git rebase to merge two commits, one is farther and one is recent

git,merge,rebase
I want to merge two commits. One is farther back and the other is the recent one in my git history. Here is my last 12 commits in a branch (not in master). $ git log -12 --pretty=oneline 47c724a6fdbb6a0b6d51cd42d0bde92c23a0d32e L 9446932bc6e13d0437ab6b3f03161e3c2bca0f62 K Follow up of A 842e6a97284a02a70122d50f2f647a51b0e5cce7 J 77a0e99a62d9f77044cc37cbe22870b11c83f046 I...

Automatically rebase gerrit Changes

git,jenkins,rebase,gerrit
My current development environment consists of a Git/Gerrit setup which runs several Jenkins jobs to validate the submitted changes. The submit type in Gerrit is set to "Fast-Forward only". The "problem": Change A is pushed to gerrit, validation builds on Jenkins are triggered Change B is pushed to gerrit, validation...

Git rebase failure with auto-generated file

git,rebase,auto-generate
I'm working on a code base where one file is autogenerated and changes very frequently. I find that rebasing my local branch usually results in falling back to three way merges and failure on this file. I then have to fix the file up and continue, but this can happen...

git: Merge Branches but Keep Commit History

git,version-control,branch,history,rebase
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...

Perforce - “rebase” a previous submission

version-control,perforce,rebase
So, a while back, I p4 submitted some changes. Then I realized that it wasn't the right time to do that yet. So I immediately made another submission which is the inverse of Change 1. I used the method described under "Backing out an old changelist with adds and deletes...

rebasing with autosquash doesn't work as expected

git,rebase
I'm trying to squash last 3 commits using autosquash options provided by git-rebase. I have the following history: * commit 78a7e4844fa32d2ef1bb7bd9b44c4a1b9551d31a (HEAD, new) | Author: maxim koretskyi <[email protected]> | Date: Fri Feb 20 10:29:48 2015 +0200 | | squash! s3 | * commit f25491cadc646baf14bd7e951245c6777230a1d7 | Author: maxim koretskyi <[email protected]> |...

Git rebase original project

git,github,rebase
I have forked a project. I am the sole maintainer. Now the original project has changed its master branch. Can I merge those changes in my development branch or in both my master and development branch? I read about rebase but I'm not sure that's how it should be done...

Why does rebasing unset my current branch and does not complete?

git,rebase
I'm on branch b4 and do "$ git rebase master", it gives me conflicts. $ git rebase master First, rewinding head to replay your work on top of it... Applying: rebase: Modified 1.txt Using index info to reconstruct a base tree... M 1.txt Falling back to patching base and 3-way...

How to pragmatically check with bash script if a branch in git needs to be rebased?

git,bash,rebase,git-rebase,git-bash
I'm working on a bash script for my team to enforce regular rebasing of working branches. The problem I am facing at the moment is how to determine whether a branch is behind master and/or if it needs to be rebased, rather than blindly attempting to rebase the branch. Here...