0

Hey guys quick question about GIT. Using Github Desktop on local machines with local Git server. I have read about the .gitignore and cant seem to find an answer. I have a folder setup like this

Root\Company1\Projects\Project1

Root\Company2\Projects\Project1

Folder company1 is a repo as well as company2. On the masters of these are all our core sources. I have branches for each project under them i create correlating with the projects folder. What happens sometimes is say I commit to a project branch, then i move to the master branch and merge into the master from my branch. Then I forget to change to project2 branch and I make changes to a file in project2. Now my changes show on my master branch. I am wondering if it is possible to setup the master branch to ignore my whole projects folder while I am making changes, but be able to merge into my Master branch with those changes when I am ready to merge. If i create a git ignore file for the master branch ignoring my Projects folder will those changes i make and commit to the project branch move to the master when i merge that branch into the master? If that is not the case is this possible to setup? It is not a huge problem, just annoying and i end up having project files in my master that are not ready yet. I bounce around from project to project many times a day and it would be beneficial to me. Thanks

  • 1
    Changes you have made in your working tree, but have not committed, are *not on any branch*. If you run `git commit` while in the wrong branch, that's a bit different, but easily fixed. You might read through my answer to [this question](https://stackoverflow.com/q/70256642/1256452) here. If you want to have a double-check run before a `git commit` proceeds, though, consider setting up a pre-commit hook. – torek Dec 10 '21 at 07:41
  • 1
    Note that this is all about *Git*. You mention GitHub Desktop. That *uses* Git, but *is not Git* and does not behave like Git. For questions about GitHub Desktop, use the [tag:github-desktop] tag. – torek Dec 10 '21 at 07:45

0 Answers0