what Git Ignore field means in github desktop while creating a new repository - gitignore

see the Git Ignore option in the below image.What I have to choose, I am creating an ionic-framework repository.
https://i.stack.imgur.com/pBvkd.png

.gitignore is a file which, Git uses to determine which files and directories to ignore, before you make a commit. These files/directories will not be pushed into the repository.
If you have any files or directories that don't need to be pushed into the repository, then you can include them. (a simple example : log files)

If there is no ionic option, you can ignore it, and create it locally on your repo, then push it back to your GitHub repo.
To create it, see https://www.gitignore.io/api/ionic3
It does generate an Ionic .gitignore for you.

Related

How to ignore eclipse metadata but preserve the template?

I've got an ARM project in Eclipse...Actually, I'm using the STM Workbench packaging of Base-CDT-Eclipse.
I'm working with a few other guys and we're using a git server to push and pull from.
However, everyone has a little bit different setup as far as where their toolchains are, OS's, etc.
This is causing trouble, because we're git dummies, and when we push changes after working locally, we do
git add .
git commit -m "some message"
git push origin master
And when we pull changes, we just do
git pull origin master
And pray that there no one else did anything in the meantime, because we're afraid of merging differences, but that's a different story.
Anyway, this whole project has a few sub directories that include things like datasheets, Word documents, and what-not...but, it also includes the metadata for the Eclipse project. So, the last person to commit also pushes their unique settings for things like tool-chain path, preferred builder, etc. This breaks the other guys' setup and after each pull, everyone else has to manually update their project settings to fix this.
So, what files are special to Eclipse for project settings and how can I tell git to ignore these files if they already exist? They need to be available for, say, a git clone but they need to be ignored for subsequent git push's and git pull's.
If you need the setting file and not rename it and it's ok forsetting file need not to do version control, so there is a way by .gitignore with below steps:
Create a .gitignore file. touch .gitignore
Edit and save the .gitignore file
.gitignore
filename
Remove the caches from version control. git rm --cached filename
Commit and push
You can ignore those files changes locally with:
git update-index --skip-worktree -- .project
git update-index --skip-worktree -- .classpath
See: "Difference Between 'assume-unchanged' and 'skip-worktree'", it should better resist to git pull.
Another option would be to a content filter driver which generates (automatically on git checkout) a .classpath if it does not yet exist.
That allows you to version a .classpath.tpl template, and you can keep your actual .classpath completely private (and in your .gitignore)
See this answer for more.

Can I create local version of .gitignore that applies only to my local repository?

There are some files/directories in the remote git repository for my project that I don't want in my local repository. They are useful to other project members, but not me. And I can't just identify them in the root .gitignore file because when that file becomes part of the remote repository it becomes the rule for everybody else so they change it back. We don't want to get into a .gitignore war.
Is there a straightforward way for me alone to selectively chose the files/directories that I do or don't want to exchange between the remote repository and my local repository when I do a 'git pull'? To be clear, I'd like to make my selections once and have them take effect every time I do a 'git pull' (or equivalent) and not force them on anyone else.
You can add .gitignore to your .gitignore file.
You then git rm .gitignore and it is no longer tracked.
Then just remove the other files you don't want tracked.

Add new folder with files to github

Probably one simple question. I pushed my first project to github. I've done it with Eclipse with EGit plugin. I've clicked on a project, chose to push remote and uploaded it to git. There I have created readme file online so the structure looks like this:
Git
-- AppFolder
------srcFolder
------libsFolder
------resFolder
------etc etc
-- Readme.md
I have one other folder with screenshots of the app which I would like to have outside my app folder. Something like this:
Git
-- AppFolder
------srcFolder
------libsFolder
------resFolder
------etc etc
-- Readme.md
-- ScreenshotsFolder
------screenshot1
------screenshot2
------etc etc
How can I accomplish that? I don't want to put that folder with screenshots to AppFolder. Thank you.
Locally, just create the ScreenshotsFolder in the same directory level as AppsFolder and README.md.
Then, git add ScreenshotsFolder will add the folder and all of its content (really, all content that is not in your .gitignore file if you have one).
Next just git commit then git push remote_repo remote_branch (ex: git push origin master).
If you aren't doing this via the command line, I'm sure the EGit plugin has some option to add the ScreenshotsFolder and do a commit then push...haven't used EGit myself, though. The steps are the same either way, just a different interface.
Are the files intended to be committed? If not, you could just .gitignore that directory.
edit: if the files are meant to be committed, why can't you just add and commit them like normal, but in new directory?

Eclipse Projects And Git

I used computer A via the Terminal to create a) create a git repository, b) add an index.html file to the repo, c) add a remote origin, d) push to the remote origin. All OK.
Then, i used computer B to clone that repository via Terminal. Then, I opened Eclipse (equipped with Egit), and created a new project in the folder that was created by the cloning process. Then I used Eclipse to push any changes to the remote origin.
Returning to computer A, I used Eclipse to create a project in the original repo folder, and then I attempted to pull from the remote origin, in order to get the changes that were pushed when using computer B.
Eclipse will not do it. It complains the I have items such as .settings, .project and similar and since they are not under version control it won't overwrite them by fetching files from the server. I had to manually delete those files (via Terminal) and then Eclipse worked as expected.
Please provide information on how to avoid this.
Should I create the local repo from within Eclipse and then push it to the remote origin, so that items such as (.settings) are under version control and (if so) how would that cause trouble to people cloning the repo and use different versions of Eclipse?
Should I gitignore those items?
Should I ask Eclipse to save its own affiliated files to another folder (not that i am aware how to do that, i only know that NetBeans does it)?
Looks like you didn't gitignored eclipse files.
Probably, when you commit/push via egit, you also commit and push those files you already had unversioned in your machine A, so git complains, because you are asking to override existing unversioned files.
I strongly recommend you to gitignore those eclipse files. You can see examples of .gitignore files in the github gitignore repo.
Hope it helps.
It complains because if you pull the changes from your remote it will overwrite your local files. That is the problem. The other answerer has right. You should better add all the eclipse project files and and target .settings and classpath to gitignore. You can use a global gitignore for your computers as well, before creating projects. You could use maven for example, then you can import your projects only from the pom.xml-s given in the git repository.
I use them the same. Egit and other guis are a bit too complex to work with. Git repositories can get easy in an inconsistent state where you should use the oldfashioned terminal to solve things. Like, rebasing, merging on conflicts. Gits learning curve is solid.
Now you can solve your problem if on the first computer save a backup of your original and clones your project later, after fixed it on the second. On the second git remove all this files, but use the --cached option to avoid deleting them. Before you do it so, check the help of git remove! after you have done this, put them into the .gitignore as filenames with wildcards. You can also use a global gitignore file in your user folder. Creating a .gitconfig file where you can specifiy the global ignore with the following :
[core]
excludesfile = ~/.gitignore_global
Than just create the .gitignore_global like this :
/nbproject
/bin
/build.xml
.idea
chess.iml
target/
bin
( This file is for idea and netbeans. you can add eclipse project files here )
You can have .gitignore files per project too. You can commit them to the repository, so on the next machine you do not have to do this again. The nicest way I think is having a dotfiles git repository, which is a git repo of your home directory and the dotfiles in it. I also use it for different windows and linux distros.
That's all. You should keep all of your configuration in a safe place. And source code management can do it. But do not commit private stuff to public a place! ;)
Oh I wanted to mention that, you can also have a .gitignore entry in your .gitignore file. That can be very useful when you do not want to touch a repository but need to add a gitignore to hide some stuff especially from the given repo.

push specific files using egit

I thought this would be a no pbrainer, but for some reason can't find anything on the issue - is there a way to push only specific files from egit? Our repository contains a lrage number of files which are mainly of no interest to me, and every time I try to push I get many DIRTY_TREE errors in files I don't care about. Right-clicking on a file and then attempting push, just tryes to push the entire repository
I'm using Eclipse Juno from mac, and BitBucket repository
Thanks!
Git push deals with commit objects, not with files. If you want to push specific files, you have to make a commit that contains only those files. In your case, you might want to look at the git update-index --assume-unchanged <files> command, or at the .git/info/exclude file, which is like .gitignore except it's for your local repository only (doesn't get shared with the upstream repo).