github - Git, ignored files appear in every branch -
i have repo test-repo
, contains 2 branches master
, dev
. files / directories in master
branch's .gitignore
files appear locally in both branches when git checkout
them, assume normal behaviour files aren't being tracked git they're in test-repo
directory no matter what. don't want happen. ideal setup below:
when git checkout master
local file / directory structure should so:
test-repo/ .gitignore (this file contains `should-be-ignored.md`) should-be-ignored.md should-only-show-in-master.md
when git checkout dev
local file / directory structure should so:
test-repo/ should-only-show-in-dev.md
if has idea on how achieve setup i'd appreciate it.
the real-world version: i'm working on github, when add branch of gh-pages
acts free static web hosting essentially. have repo contains front-end web build boilerplate, master
branch contains code , gh-pages
branch include examples of code etc. when i'm working on boilerplate locally run grunt (a task runner) run needs command npm install
installs dependencies, creates directory of node_modules
in root of repo, don't want show on remote repo put directory in .gitignore
file. in dev
branch (locally) directory still shows up, if wanted separate grunt tasks files in dev
branch? mean i'd need node_modules
directory in branch, can't done since 1 master
branch in local directory no matter what. see problem now?
with additional context have provided regarding gh-pages (thought bit confused master , dev branches coming in picture):
the gh-pages branch separate repo , serves different purpose (usually documentation.)
what not keep checking out between code branch , gh-pages branch. clone repo 2 times , have 1 normal development, , other gh-pages stuff. keeps simple, , 2 treated 2 repos, should be.
Comments
Post a Comment