Why does .meteor have a .gitignore file? - version-control

I am creating a new meteor app and would like to put the whole thing under git source control. When cloning a working copy of my meteor directory, meteor gives : run: You're not in a Meteor project directory.
After inspecting the .meteor directory, I see that the files in here are being excluded in my local clone.
Is there a particular reason this is done?

as #Swadq already pointed about, the .meteor directory is Meteor's directory. It contains a folder and a file.
The local directory contains the compiled version of your application and some database information (lock-file and the actual raw data of mongodb). This of course should not be included in your VCS.
The package file contains all packages meteor should load for your application. This is of course important and must be included in your VCS. More importantly: this file is checked for to determine if the current directory is a meteor application. If you don't include this you'll loose the packages you relay on and the ability to simply run the app. using meteor.
So ideally your .gitignore file only should contain .meteor\local but not .meteor\packages. When using meteorite the .gitignore file should contain .meteor\meteorite as well.

Related

Is the .git folder necessary in the database?

There is a .git folder inside my template database that wasn't there before AFAIK. It must have happened when I clicked Sync with On-Disk Project recently, but I really don't know exactly when or why.
It's rather annoying, because handling this folder can take quite some time when I compile the application.
Do I need this folder inside the database, and if not, how can I get rid of it, i.e. remove it from the database?
The .git folder and its content is of no use inside your database. The problem arises because the on-disk content of your database is at the same level as the .git folder. The .git folder is therefore imported into your database when you sync with the on-disk project.
You should move the on-disk content of your database to a sub folder of your Git folder.
Here's an example of the folder structure (using the OpenNTF Domino API Demo Database):

EGit working directory not under the local repository

The working directory should be visible on a WebDAV server and none of the parent folders should contain the repository itself.
I want to separate totally the folder for .git and the working directory (on a different drive, clean from project files and others).
Using Eclipse EGIT, the repository creation allows set of working directory (Target Location) within a path within the repository.
No way found to set GIT_DIR or working_directory within Eclipse. Linking not an option (Windows)
The project .location contains the place within the repository (and that is a binary file anyway), so that should be configurable.
Is there any way to move the working directory to a totally different place?
Is there a configuration option I have missed?
After editing the files, do I really have to push all to the server, then commit to git?
To summarize what has been written in the comments, EGit does not support Git repositories whose work directory is at a different location than the .git directory. I.e. the core.worktree configuration setting is not taken into account.
See also this open enhancement request: https://bugs.eclipse.org/bugs/show_bug.cgi?id=433451

yii2 vendor and some files are missing from github

I have set up a new repo on github and pushed yii2 advanced template. Now i realized that some folders/files are missing from github like vendor and backend/web/index.php.
Anyone have idea why this is happening, i also checked my local git setup there files are present.
Check out the installation guide.
Running composer install is what creates the vendor folder, while running init creates those index.php files.
I have found that its happening because of .gitignore file. i removed it and its working fine for me.
It's quite simple idea behind missing these files, they are called ...-local.php, because their content can vary for different developers or production conditions. All you have to do before upload yii2 to the github, check the /environments directory, it includes templates for the local files, so after yii2 project is copied from the github, they will be generated by ./yii init.
Step-by-step, what should be done:
Configure files in /environments/dev and /environments/prod (for production). Most likely, if you don't change the yii2 project file structure or touch any of the /config files, you don't need to adapt them.
Update /environments/index.php, if you have updated /environments files
Upload the project to GitHub
Clone the project and run composer install to install dependencies
And finally run ./yii init from the root folder. You will see that ...-local.php files are now generated in certain directories the same way as they are configured in the environments.
More detailed information about this topic: https://www.yiiframework.com/extension/yiisoft/yii2-app-advanced/doc/guide/2.0/en/structure-environments

Is there a way to control what gets into a GitHubs zipball?

Every GitHub repo has the Download ZIP button, but is there a way to control what gets into the final zipball. For example we do not need and hidden files there, or even - unit tests.
Excerpt from Pro Git book:
You can tell Git not to export certain files or directories when
generating an archive. If there is a subdirectory or file that you
don’t want to include in your archive file but that you do want
checked into your project, you can determine those files via the
export-ignore attribute.
For example, say you have some test files in a test/ subdirectory, and
it doesn’t make sense to include them in the tarball export of your
project. You can add the following line to your Git attributes file:
test/ export-ignore
Now, when you run git archive to create a tarball of your project,
that directory won’t be included in the archive.

How can I add a directory tree to my github repo?

I've been working on a project that's fairly far a long now and I decided it's time to use some sort of version control etc. I decided to go with github. Before I get in too deep let me state explicitly that I am new to github.
My project resides in a directory that contains myriad subdirectories and files of all different kinds. I'd like to take my project directory as is (structure and all) and put it in my github repo.
I followed the tutorials on github's webpage, created the repo, and manually added some files. Obviously I don't want to manually add every file (there are several hundred). I'd like to know how I can add the root directory or for that matter any parent directory and all files/folders in said said directory. In other words I'm looking for a recursive add.
I read on this SO page (How to create folder in github repository?) that you can just use
git add directory/
That works fine for me when I'm dealing with the lowest level directory, but when I try the same command on a directory with subdirectories my terminal just sits there and I have to ctrl-c. I can't tell if it's just taking a long time (as I mentioned there are lots of files) or if this is just the wrong way to add a directory with subdirectories.
Apologies in advance if this is a super ignorant question -- I have looked at a lot of blogs/posts/etc and I cannot find a solution that seems to work.
Use the Current Working Directory
Assuming you're on Linux or OS X, from the command line you would do the following:
git add .
from the root of your repository tree. That will add all non-ignored files, including non-empty directories, into the repository.
From the root directory (the one with all the subdirectories), use git add -A.
If you have a ton of subdirectories and files, it may take a long while, so just let it sit there until it's done.