Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6616571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:35:56+00:00 2026-05-25T20:35:56+00:00

When using Git, I often find myself doing the following when working in master

  • 0

When using Git, I often find myself doing the following when working in master:

# work work work...
$ git checkout -b temp
$ git commit -a -m 'more work done'
$ git checkout master
$ git pull origin master
# turns out master was updated since my previous pull
$ git checkout temp
# I don't want a merge commit for a simple bugfix
$ git rebase master
$ git checkout master
$ git merge temp
$ git push origin master
$ git branch -d temp

… and I get tired of doing this. Is there a way to do this dance without all of the checkouts, and preferably without (manually) creating the temporary branch?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T20:35:57+00:00Added an answer on May 25, 2026 at 8:35 pm

    If you don’t mind not creating a branch called temp, you could just do the following all on master:

    git commit -a -m 'more work done'
    git fetch origin
    git rebase origin/master
    

    … or equivalently:

    git commit -a -m 'more work done'
    git pull --rebase origin master
    

    If you do want to keep the temp branch, however, you can still make this a bit shorter by not checking out master just to do the pull – you only need to fetch and then rebase your branch onto origin/master:

    # work work work...
    $ git checkout -b temp
    $ git commit -a -m 'more work done'
    $ git fetch origin
    # It looks like origin/master was updated, so:
    $ git rebase origin/master
    # Then when you finally want to merge:
    $ git checkout master
    $ git merge temp
    $ git push origin master
    $ git branch -d temp
    

    sehe’s answer reminds me that you could replace:

    $ git fetch origin
    $ git rebase origin/master
    

    … with:

    $ git pull --rebase origin master
    

    … which is nearly equivalent. The difference is that when you run git fetch origin, all of your remote-tracking branches for origin will be updated, whereas when you pull a particular branch from origin, none of them are – it’s just the temporary ref FETCH_HEAD that is updated. I personally prefer running one extra command (git fetch origin), and seeing all the remote branches that have changed in the output.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using msys-git and notice I often get strange characters in the output after
When using git submodules, what is the preferred way of doing customizations? Should I...
I'm currently working on .Net projects that are using either Git or Mercurial (Hg)
We are using submodules and we are new to git. We often see merge
Case Quite often I find myself staring at some old code that doesn't look
I have a problem! We are working on an iPhone-app and are using git.
I'm using git, and I'm setting up the following branches to support my workflow:
Using git I made something like this git clone git checkout {a rev number
I've been using git for some time now on Windows (with msysGit) and I
I've been using Git on Linux for about a year, and everything works fine.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.