Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds git alias to rebase current branch with master #4802

Closed
wants to merge 1 commit into from

Conversation

viniciusffj
Copy link

Adds the alias grbb that rebase the current branch with master.

This alias abstract the following:

$ git branch
  master
* my-feature-branch
$ git checkout master
$ git pull --rebase
$ git checkout my-feature-branch
$ git rebase master
First, rewinding head to replay your work on top of it...

So instead you'd only use:

$ git branch
  master
* my-feature-branch
$ grbb
First, rewinding head to replay your work on top of it...

@mb-dev
Copy link

mb-dev commented Feb 26, 2016

ooo, I want that!

@mcornella mcornella added new Topic: alias Pull Request or issue regarding aliases labels Mar 30, 2016
@kevin-verschaeve
Copy link

Why not using: git pull --rebase origin master on the my-feature-branch branch ?

If the alias is really needed, it can become

function rebase_with_master() {
    local b=$(git_current_branch)
    git pull --rebase origin master
}

So you do the same with only one instruction.

And because I rebase mostly on a develop branch, this can be improved like this:

function rebase_with_branch() {
    local b=$(git_current_branch)
    branch=$1
    if [ -z "$branch" ]; then
        branch="master"
    fi

     git pull --rebase origin $branch
}

and used like this: grbb develop or without argument, which will rebase to master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Topic: alias Pull Request or issue regarding aliases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants