1

I have local repo and remote, say "upstream". In remote repo some basic configs say "file1.txt" and "file2.txt", I pull changes to branch "some_branch", and typed:

git update-index --assume-unchanged file1.txt
git update-index --assume-unchanged file2.txt

to allow modify this files, add some changes with my local changes, which I do not want to commit.

After that in "upstream" was added branch "somefeature"

fetch upstream somefeature:somefeature

and try:

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

$git checkout -f somefeature 
error: Entry 'file1.txt' not uptodate. Cannot merge.

then I try:

$git stash 
No local changes to save

$git stash -u
No local changes to save

$git update-index --no-assume-unchanged .
Ignoring path 

also I tried "--skip-worktree", but unsuccessfully also.

So, how I can skip local changes whan use "add" or "commit -a", but be able to change branch, and apply this hidden changes to unother branches, created not from current?

anber
  • 3,463
  • 6
  • 39
  • 68

1 Answers1

1

To stash everything try:

git stash save --all --no-keep-index
Ruslan Osipov
  • 5,655
  • 4
  • 29
  • 44
  • but when I come back to first branch, I can't restore state, when I use "git stash apply", it say "Could not restore untracked files from stash " – anber Apr 03 '13 at 15:56