1

I'm relatively new to using Git and currently utilizing Git for Windows along with Visual Studio Code (VS Code) as my primary code editor. I have already partially set up source control in VS Code.

I'm seeking guidance on how to make a repo and then establish a main branch to contain my most recent working code, which I'll manage with manual commits and pushes. Additionally, I'd like to configure a test branch that automatically commits and pushes changes but not sync. Then this test branch should generate a pull request to the main branch, allowing me to review and decide whether to accept or decline the changes. Alternatively, I want the flexibility to manually push changes from the main branch after thorough testing.

A specific challenge I face is managing files and folders that need to be hidden in the main branch but remain visible in the test branch. I would like to avoid modifying the .gitignore file each time I switch branches. Perhaps there is a way to have two .gitignore files, one associated with the Test branch and another with the Main branch.

I am a complete beginner to Git. I am keen to learn how to set up this workflow in VS Code.

halfer
  • 19,824
  • 17
  • 99
  • 186
  • 1
    I don't think you should keep confidential files in the same repo if they must stay out of your main branch. Sounds like an accident ready to happen in the future... Can't you store that into a different place? – James Z Aug 03 '23 at 18:09
  • @JamesZ uh okk....??? that wasnt my question – Axel Turner Aug 05 '23 at 16:21
  • `I would like to avoid modifying the .gitignore file each time I switch branches.` This modification is done automatically by checking in such changes as [*temporary commits*](https://stackoverflow.com/a/75010635/23118). – hlovdal Aug 06 '23 at 10:37
  • And also set out to learn *[interactive rebase](https://about.gitlab.com/blog/2020/11/23/keep-git-history-clean-with-interactive-rebase/)*. It is a tool you should be using multiple times per day. https://youtu.be/zb5TXz2dHbU https://youtu.be/rt9ZOVciJm8 – hlovdal Aug 06 '23 at 10:38

0 Answers0