-2

This has been driving me crazy, and I'm not sure how to approach it without creating an entirely different repository. I have a live website on branchA using master branch, and I want to completely rewrite the website, thus I want to push the new code onto branchB. Here are the steps I do:

git checkout -b branchB
git add -u
git commit -m "Why isn't this working"
git push origin branchB

And God knows why, it keeps adding these local files that I don't want into the commit and now I have these irrelevant files in my branch. I tried to git add each individual files in that folder too.

Can someone walk me through this? I've been on this for two nights now.

patrickhuang94
  • 2,085
  • 5
  • 36
  • 58

1 Answers1

1

Your best bet will be to use a .gitignore file.

In the root directory of your Git repository, make a file called .gitignore

touch .gitignore

Then open the file with notepad (or a text editor of choice), and add the names of files you do not wish for Git to see. There are several community created .gitignore files for various project types as well.

It is also notable that a gitignore file can use wildcards. I suggest you read up some gitignore documentation on the subject.