-1

Here is scenario, my local branch is development:

> $ git status
> On branch development 
> nothing to commit, working directory clean

Here is all the branches:

> $ git branch   
> configuration
> * development
> hotfix-1.2
> master
> release-1.0

Now if i do checkout to master, it shows me this:

> $ git checkout master
> error: Your local changes to the following files
> would be overwritten by checkout:
>         .htaccess
> Please, commit your changes or stash them before you can switch branches.
> Aborting

Note: i put .htaccess file in .gitignore because production server has different than staging

Imran Khan
  • 2,373
  • 2
  • 22
  • 35

1 Answers1

1

hey you had change something in .htaccess file, which is in .gitignore

  1. You can stash it using git stash

  2. Or If you want changes in that file you can commit it.

    git commit -m "add .htaccess file"

Then try to checkout on Master branch. hope it will help :)

Vrushali Raut
  • 1,130
  • 1
  • 10
  • 20
  • Thanks, but there's nothing in my stash when i try to 'git stash' neither any change when i do 'git status'. – Imran Khan Nov 29 '17 at 08:26
  • ```error: Your local changes to the following files > would be overwritten by checkout: > .htaccess > Please, commit your changes or stash them before you can switch branches. > Aborting``` This message say's there are something changed in your local repo.. which eigther need to be commit or stash – Vrushali Raut Nov 29 '17 at 09:15