![]() Have a "master" branch which contains the default configuration of your code (e.g., the machine you use most frequently, or the production machine). ![]() If instead you mean that you have some application, but you need different configurations depending on which machine you work/compile on, that should be tracked as branches in the same repository, not as a separate clone of git repository. Link your application-specific code to the library code the way you would normally link against any third-party library. ![]() The application-specific code should be in a separate, new repository (not cloned from the library repository). If it is a library of common data structures, utilities, and such, that should all be contained in a separate git repository, and you should not include application-specific code, which relies on the library, in that repository. ![]() This is very common for when you're needing to make updates to an existing project, or maybe if you want to clone a skeleton project to help get you started.It depends what you mean by "core codes". Cloning an Existing ProjectĪlthough you aren't technically creating a new repo, in this use-case you can clone an existing one, preventing you from needing to git init one yourself. gitignore is not only recommended when creating a repo for an existing project, but we reference it here because you're more likely to need it for an existing project, as more mature projects tend to accumulate files that shouldn't be tracked or shared between users. Notice that our ignored file (package-lock.json) and directory (node_modules) are not included in staging, even after executing git add. rw-r-r- 1 scott staff 362 Sep 16 15:32 package.json rw-r-r- 1 scott staff 0 Sep 16 15:15 index.jsĭrwxr-xr-x 4 scott staff 136 Sep 16 15:27 libĭrwxr-xr-x 52 scott staff 1768 Sep 16 15:32 node_modules Now when these "ignored" items are present in your project you don't need to worry about accidentally staging and committing them. gitignore file.īacking up a little, our commands to create a repository for an existing project may look more like this: $ git init In order to avoid including unwanted files/directories like this, you should create and commit a. However, it will also add some files or directories that you might not want, like node_modules for a Node.js project. command will add all files in the current working directory, including those in subdirectories. Initial commitĢ files changed, 0 insertions(+), 0 deletions(-) Once you've added some files and feel like you're at a point in which you should commit your code, you can use the add command to add your files to the new repo: This can be done at any time in your project, whether there are already files there or not. Initialized empty Git repository in /Users/scott/projects/my-new-project/.git/ To do this, go to your project directory and type the following: $ git init In order to start this new repo you'll want to use the init command. In this article we'll show a few ways to create a new repository. With a full history of those changes, and helpful features like branches, you can more easily test out different designs/implementations for the project without losing previous work.Īs with anything in Git, there are a few ways to do what we want, depending on what you need. This not only helps you share the project with coworkers, or publicly, but it's also a great way to track updates to a young project that is bound to go through significant changes in its early life. When starting a new project, one of the first things you'll find yourself needing to do is creating a new Git repository.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |