Closed ivirshup closed 7 years ago
This isn't a fix, but you can use the -mo
or --move-over
flags to explicitly move these uncommitted changes over. From the command line help:
gl switch --help
usage: gl switch [-h] [-mo] branch
Switch branches
positional arguments:
branch switch to branch
optional arguments:
-h, --help show this help message and exit
-mo, --move-over move uncomitted changes made in the current branch to the
destination branch
Is there some way to set command defaults?
Can we get confirmation from someone that this is a bug? Or, if not, some rationale why this is desirable behavior, and a workaround that allows us to replicate Git's .gitignore
behavior?
This is expected behavior, in Gitless branches are completely independent to each other and it is as if each has their own working directory. If you want uncommitted changes to follow you to the branch you are switching to use the -mo
flag like @edwardloveall suggested.
The rationale for this behavior is that having completely independent branches lets you shuffle between tasks without difficulty and that keeping the changes separate is what you want in most cases.
Ok good to know. Some of my git repos are organized such that large data/ repositories are within the same root folder as .git/, but hidden via .gitignore. Can i work with gitless in a way that allows me to share these resources between branches without having multiple copies?
On Tuesday, October 11, 2016, Santiago P De Rosso notifications@github.com wrote:
This is expected behavior, in Gitless branches are completely independent to each other and it is as if each has their own working directory. If you want uncommitted changes to follow you to the branch you are switching to use the -mo flag like @edwardloveall https://github.com/edwardloveall suggested.
The rationale for this behavior is that having completely independent branches lets you shuffle between tasks without difficulty and that keeping the changes separate is what you want in most cases.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/sdg-mit/gitless/issues/40#issuecomment-252940120, or mute the thread https://github.com/notifications/unsubscribe-auth/ACT_WJpNxCy-6oSfXtxrXaxSbgrd1lUSks5qy6IUgaJpZM4FXxOw .
Files and directories in a .gitignore are associated with branches. That is, if I modify files in an ignored directory in
branch1
, then switch tobranch2
, my changes will not be reflected inbranch2
. This can also cause problems when switching back to plain old git, as ignored files persist. So if I, following the previousgl
commands, switched tobranch1
with$ git checkout branch1
the modifications in the ignored directory will be lost.The following code should replicate the bug.