Estoy en twig wip
y quiero moverme a Branch dev
. Tengo algunos cambios no comprometidos en el directory de trabajo.
$ git checkout dev error: Your local changes to the following files would be overwritten by checkout: .idea/runConfigurations/celery_beat.xml Please, commit your changes or stash them before you can switch branches. Aborting
Ok, lo entiendo: ese file no se fusionará. Y no quiero perder mis cambios a eso. Lo que quiero es:
Alternativamente, a veces quiero esto:
wip
deberían permanecer como están, el rest del directory de trabajo debería completarse desde la twig de desarrollo. Un simple git diff
me mostrará los cambios que tengo después de moverme a la twig dev
. La forma en que resolvería esto ahora es:
git status
git checkout -- .
git checkout dev
git diff
me da ahora los cambios en comparación con dev
¿ git
tiene un mecanismo incorporado para hacer esto?
#stash the changes to ".idea/runConfigurations/celery_beat.xml" git stash #switch to dev without conflicts or overwriting git checkout dev #restre ".idea/runConfigurations/celery_beat.xml" to the version before the switch git checkout stash@{0} -- .idea/runConfigurations/celery_beat.xml #now ".idea/runConfigurations/celery_beat.xml" is staged, in order to remove it from the index: git reset HEAD -- .idea/runConfigurations/celery_beat.xml #if you'd like to drop the stash entry git stash drop
Pero aún tengo que decir que no es una buena idea seguir .idea
.