FAQ Database Discussion Community


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 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...

Git - are these processes equal?

git,git-merge,git-rebase
I would like to ask you what is the difference between two approaches. Starting situation is: master branch | E F - test branch | | D C | / B | A First approach: git checkout test git merge master git rebase -i master git checkout master git merge...

git rebase - does pick effectively do nothing?

git,git-rebase
Say I want to do an interactive git rebase. I use git rebase -i HEAD~2 and end up in the editor with 2 lines starting with pick. If I go ahead and exit the editor then I get the message Successfully rebased and updated refs/heads/master.. The last few commits all...

How can I rebase from a remote tag onto local master

git,git-rebase
I cloned an open source third-party repository and started working locally, committing to local master. The remote github repository now has a tag called 8.1.1 Whats the best way to rebase from that remote tag? I want to pull in the latest changes from that release only and then replay...

Is there a difference between git rebase and git merge --ff-only

git,git-merge,git-rebase
From what I read, both of them help us get a linear history. From what I experimented, rebase works all the time. But merge --ff-only works only in scenarios where it can be fast forwarded. I also noticed, git merge creates a merge commit, but if we use --ff-only, it...

rebase in progress. Can not commit. How to proceed or stop (abort)?

git,git-rebase
When I run: git status I see this: rebase in progress; onto 9c168a5 You are currently rebasing branch 'master' on '9c168a5'. (all conflicts fixed: run "git rebase --continue") nothing to commit, working directory clean When I do: ls `git rev-parse --git-dir` | grep rebase || echo no rebase I see:...

what is inlining merges when rebasing

git,git-rebase
I'm reading this article about git rebase, which contains the following passage: By default, a rebase will inline merges. As we now make sure our merges have clear semantics in our history graph, this inlining is real bummer... We can avoid this by telling rebase we want to preserve merges:...

what happens downstream when force pushing a git rebased history

git,git-rebase
Imagine that someone forces a rebased push and people downstream have been doing things, what would happen to them? Do they have to remerge all conflicts again?

git rebase - is squashing initial commits generally a bad idea?

git,git-rebase
Am I right in thinking it's not a good idea to squash initial commits in most repos? I've seen lots of answers telling you how to squash the last commits but I assume, on a shared repo, it's not wise to squash initial commits as you're basically rewriting history....

How can I rebase part of a branch to the master branch?

git,git-rebase
Originally, I had something like this: C---D (branch1) / A---B (master) Because I needed to work on something else (which was unrelated to branch1), I decided to make a new branch (called branch2). I made a couple of commits on branch2 and then pushed them. Now, my intention was to...

Rebase instead of fast forward

git,git-branch,git-rebase
I'm new to GIT and I can't figure out if my question already has an answer. Please read it carefully before marking it as duplicate. I have a branch, let's call it public, which is pushed and in sync with origin. At one point, I create another branch, private, which...

Rebasing to change parent of a merge commit

git,git-rebase
Suppose I've got the following history, where the top line is the master branch, the lower one is a feature branch that's merged with master at one point, and D just reverts C (which means that the working directory is the same in B and D). A---B---C---D master \ \...

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...

How can I reference the original of a currently edited commit during git rebase?

git,git-rebase
I would like to get some information about the original of the currently edited commit during a git rebase -i but HEAD references a different commit hash. How can I reference the original commit? Example: $ git rebase -i upstream (Choose "edit" for a commit) [detached HEAD befa32f] Previous commit...

Rename a merged commit without losing that commit's parents

git,git-rebase
TL;DR: Is it possible to rename a commit from a merged (no fast forward merge) branch - without destroying history? I want to rename a commit. Something like rebase --interactive HEAD~5. But I want to keep the HEADs in their current position. Rebase will flatten the log. I'm using feature...

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...