1

I'll attempt to keep it brief - in our project, we separated a feature branch from a development branch - we then changed the content of a file on the feature branch.

In my understanding, checking out the development branch should show the version of that file from the development branch but on our project, it doesn't seem to update at all and still has the content of the feature branch.

If that helps at all - on gitlab, the correct, unchanged file shows up - in the IDE (CLion), it still shows the changes to the file from the feature branch, despite it correctly showing in which branch we are currently in and after synchronizing.

Did I just misunderstand what 'checkout' does, or is something wrong with our setup? I'd be incredibly grateful for any help on the matter - it's really frustrating.

Pumamori
  • 75
  • 6
  • 1
    If the files are *untracked*, Git just leaves them alone. If they are *tracked*, see https://stackoverflow.com/questions/22053757/checkout-another-branch-when-there-are-uncommitted-changes-on-the-current-branch – torek Oct 05 '18 at 15:26
  • Can you show the output of `git status` to us? (You can, and should, change the branch and file names) – Vlad274 Oct 05 '18 at 15:33
  • All it says is: `On branch development nothing to commit, working directory clean` The same thing happens on the other branch, although it does that it's up-to-date with the remote branch there, too. I already tried git reset --hard, but it doesn't appear to change anything. I'll give the other question a read, thanks @torek – Pumamori Oct 05 '18 at 15:51
  • Given that `git status` output, it sounds like you are looking at untracked files that are also ignored (tracked files are never ignored). If they were untracked and not ignored, `git status` would gripe about them. If they are tracked, and are different in the commits the branches name, the contents would change when changing branches. Conclusion: must be untracked. No complaint from status: conclusion, ignored as well as untracked. – torek Oct 05 '18 at 17:26
  • Of course, untracked files wouldn't be in the other commit (they'd be tracked once you switch commits), so perhaps the problem is not Git at all, but rather your IDE (or something similar). Note that Windows can mess with GIt: some antivirus software prevents Git from modifying any files ever, for instance. – torek Oct 05 '18 at 17:27

0 Answers0