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

  • Home
  • SEARCH
  • 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 8197075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T05:40:03+00:00 2026-06-07T05:40:03+00:00

In Git, I have an experimental branch ( EXP-12 ). I have done some

  • 0

In Git, I have an experimental branch (EXP-12). I have done some changes there, but I am not ready for commit yet. I need to make adjustments on master.

I go to master.

Two cases are possible:

  1. If I included my changes into index while on EXP-12, they will appear in index on master branch as well.
  2. If I didn’t include my changes into index while on EXP-12, those files will appear as changes not staged for commit on master branch as well.

My problem is that I want everything on master and EXP-12 to be separate. I want to do some “experimental” changes on EXP-12 > go to master > do changes on master > stage everything for commit (git add -A) > commit > switch back to EXP-12 and continue experiments. Now if I do that my commit at the master branch will include all changes done on EXP-12.

What is the logic behind that? Or am I missing something?

  • 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-06-07T05:40:04+00:00Added an answer on June 7, 2026 at 5:40 am

    A classic solution to this problem is to use git stash – when you’re on EXP-12 you can do:

    git stash save --keep-index "Some work-in-progress on EXP-12"
    

    … then change branch to master as usual, do some work, change back, and apply that most recent stash:

    git checkout master
    
    [... do some stuff ...]
    
    git checkout EXP-12
    
    git stash pop
    

    However, I personally prefer to create a work-in-progress commit, and later either:

    • Change it with git commit --amend
    • Move the branch back to the previous commit, but leaving all your work as unstaged changes with: git reset HEAD^
    • … or use git rebase -i <EARLIER-COMMIT> to squash several work-in-progress commits together.

    The advantage of creating an actual commit over using the stash is that you can apply a stash on any commit, not just the one you saved it at, whereas a normal commit moves forward that branch and is tied to the earlier commits.

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

Sidebar

Related Questions

I have a branch called experiment. git checkout master echo 'some changes' > a.txt
I have a project I've been working on some experimental changes. To a sub-project
Suppose I have my master branch checked out. I've committed some production changes to
I have GIT set up to load Diffs in filemerge, but when there are
I have done some stuff to my git repo and I think I am
Git have a lot o command and is easy to forget some. So, there
I have a couple of Git branches: 'experimental', 'something' and 'master'. I switched to
I am not using github. We have git setup on our machine. I created
I have two branches: master and experimental . I'd like to rebase the changes
I created a new branch locally called experimental git checkout -b experimental I made

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.