1

Let's say I'm using git locally only, for web work in JavaScript. I've got git set up in just the base folder of the entire site, and I work on several features within that site (a rotating carousel, Ajax page loader, popup menus, etc). I obviously can't set things up into individual folders due to the structure (various scripts are in js/, images are in img/). What would be a good, clean way to work with git rather than just working on different features in one single repository? I was thinking maybe create branches called carousel, popup-menu, ajax-loader, etc., and just work on those specific features there, and merge them into the master. Does that make the most sense in this scenario, where you don't have compartmentalized projects as you would for, say, a C++ application or Xcode project?

Additional question: does it make sense to put any unrelated files in .gitignore as well, then just list the files I'm working on as exceptions? e.g.:

*.html *.php *.jpg *.js *.css !my-script.js !another-file.css 
1
  • Or maybe just *, followed by a ! list. Commented May 24, 2011 at 18:31

2 Answers 2

3

I was thinking maybe create branches called carousel, popup-menu, ajax-loader, etc., and just work on those specific features there, and merge them into the master. Does that make the most sense in this scenario, where you don't have compartmentalized projects as you would for, say, a C++ application or Xcode project?

If you are both a coder and a designer I would recommend having separate branches for JS development, PHP coding and HTML stuff. For example, you can take a look at Git's branches: https://github.com/git/git/branches.

Additional question: does it make sense to put any unrelated files in .gitignore as well, then just list the files I'm working on as exceptions? e.g.:

What do you mean "unrelated files"? If those files are in your repository, they are related to your project.

Sign up to request clarification or add additional context in comments.

2 Comments

No, I mean I work on very specific stuff (JavaScript only). I DO happen to have a bunch of other HTML & PHP & image files in my folder, but it's nothing that I need to put under version control.
Separate branches for features makes sense. Then do I merge these features once in a while into master?
2

Your .gitignore files can exist in the subdirectories where their entries make sense. There is no need to have one master .gitignore that would take care of everything. Your branching strategy seems fine. You'll be amazed at how many workflows git supports.

Hope this helps.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.