I have a project that I need to upload to my svn server. There is a folder/directory that I do not want to upload to the svn server every time I commit my project.
Is it possible to make it so that subversion will automatically not commit the directory, or will I have to uncheck that directory in the commit dialog every time. The reason that I want this is so that I wont make a mistake and accidentaly commit the directory.
Thanks,
Aidan
Add a svn:ignore property to the parent directory, and set its value to the name of the directory you don't want to commit. Then commit the parent directory.
Looks to me that you need modifiable configuration directory.
The best way to do it is to copy files under source control into some temporary place and use that place as a source for your configuration.
This way SCM system will never pick up your customized environment settings.
Related
I want to commit only a .java file to an already existing repository. I am using github for a class, and we are each given access to a private repo containing project information. I am supposed to add only a .java file to this repo, but I can't figure out how to do this. I have come close: I committed only the .java file, but it is inside a directory with the same name as my eclipse project.
Is there a way to commit only the .java file, without any of the project information, while keeping the project usable?
Thanks.
edit:
My goal is to have \git\repoName\MyFileName.java
as well as keeping the files already in \repoName\ and keeping the MyFileName.java in a usable eclipse project.
Is there a way to commit only the .java file, without any of the project information, while keeping the project usable?
yes, you will need to create a .gitignore file, and put the rest of your project into the gitignore file, (and also gitignore itself), that way, the only files that are tracked by git are the .java files.
As for the files being inside the directory with the same name as your project, take a look at where you cloned the git repo to, and make sure it is on the same level as your project files.
Take a look at this documentation
http://git-scm.com/docs/gitignore
https://help.github.com/articles/ignoring-files/
I think its much simpler than what you are expecting :)
You can do, git add, docs:
git add yourFileName.java
Now you can commit the .java file
git commit -m "I am updating only .java"
You can either reset or let it be as it is!!
git reset
reset will not have any history. So, be careful if you want to reset. In this scenario I think you dont have to reset. See here for some help.
See my answer on how to push/pull changes from eclipse into github. Let me know for any help on how to interact with github on eclipse.
You want to remove a subtree and create a new repo?
This is definnitely possible but you have to be careful. Creating a subtree only for file like yourFileName.java surprizes me a bit, but why?
For whatever reasons, see this for an easy way, and the original post is this Detach (move) subdirectory into separate Git repository
This blog might also help you.
I figured it out!!
The key was to add a source. You can do it when you create a project, one of the options will say "Link Source" or something along those lines.
You can also do it after a project is created:
Right click the project in Project Explorer. Go to Properties -> Java Build Path (on the left) -> Source (the first tab) -> "Link Source..."(button on the right)
Then just browse for the git repo folder that you already have and you're good to go! Just create new class files within /repoName in Project Explorer.
If anyone needs clarification or anything, let me know.
I changed some settings in my config file which I don't want to push to the remote repository.
I want it to effect only one project locally.
I saw there are few ways to do so:
http://365git.tumblr.com/post/519016351/three-ways-of-excluding-files (1)
Per Computer: through settings in ~/.gitconfig
git update-index --assume-unchanged (2)
I'm using SourceTree and only when I use option (2) I see the files are vanished from the UI.
What is the difference between (1) and (2) ?
Does it really means that the files are not ignored when I see them in the SourceTree after using option (1) ?
The .gitignore file prevents files from showing up as files to be added to the repository. If the file is already in the repo when it is added to the .gitignore file, any changes to the file will be shown by git and can be committed. The .gitignore settings only affect new files that are in the repos path. You would use this for keeping temp files created by you IDE or compile files from showing up and cluttering your list of files that you modified when you do git status.
git update-index --assume-unchanged doesn't show that a file was changed at all. If you make any modifications to the file, git won't show that it has been modified in git status. You would use this with config files for users. When the repository gets cloned they need to have the file but there may be some changes that they need so that they can use the code (i.e. change a file path for their local machine). But you don't want them to accidentally commit the file and mess up things for others when they pull in the changes.
For changes to a config file, you want to use the git update-index option. You want the config file in the repo but you don't want to commit the changes to it.
If I have an eclipse java project and I want to put my source code under control what is the proper way to do it in git?
My source files are under Worspace/ProjectName/src as typically in an eclipse set up.
Should I move the files to another directory where I will do a git init? Or should I do a git init in Worspace/ProjectName/src? I am not clear what is the recommended/usual approach.
It's better to do a git init in the workspace directory because eclipse detects the git repo in its workspace(if any)
and thereby allows you to manage(index, commit, push, pull, merge, rebase, fetch) your repo through plugin (egit) without even bothering to open the terminal.
It definitely gives you a joy and ease of working in IDE.
But still depends how you want to manage your project, there many ways..
I have a local SVN folder which has many files/directories/sub-directories
One of them is Project-Ear, which contains generated folders/files that I do not wish to check-in at all..
I have marked this Project-Ear folder as "unversion and add to ignore list"
Now every time, I do SVN Commit, this folder Project-Ear and it's files show in the Commit dialog.
How do I fix this? I do not want this Project-Ear to be shown at all.
If the files were initially committed into the repo, you will need to commit the "un-version" part, at that point they will be removed from the repo, and ignored from then on local file systems.
SVN doesnt commit a library like MySql connector, so when I commit my project it is not uploaded to the server, how can I do this, I how to sync another resources like pictures?
SVN, just like any other source control management system, can handle binary files as well. This should not pose a problem.
Check that the file is not under .svn-ignore or any similar ignore flag. Check that any other SVN properties that define the file are set correctly.
Subversion can support any type of file, what software are you using to make your commits? If you are using TortoiseSVN: make sure you have the "Show un-versioned files" box checked and that each file you want to commit is selected.
Bear in mind SVN only commits files marked as added to the project.
I believe you must´ve forgotten to add your file to the repository or, as Yuval A said, maybe it´s on the ignore list.