I noticed that if I do something like:
script/plugin install git://github.com/plug-xyz.git
It says it is creating a .git folder:
Initialized empty Git repository in /Users/g/Documents/app/vendor/plugins/xyz/.git/
But after the plugin is installed, it seems that the .git folder is gone.
I ask because when I try to update the plugin, nothing happens. It says it is updating, but when I check the files, they have not been updated to the latest version. I then removed the plugin, and re-installed it, and it was able to grab the most recent version.
Is it not possible to perform script/plugin update on git plugins?
You can see the changeset here: http://dev.rubyonrails.org/changeset/9049
It does remove the .git folder, presumably to save space by not storing history. This is traditional for a source control "install" instead of "checkout" or "clone" command, although it doesn't use a hypothetical "git install" command to do this.
script/plugin update looks for the .svn directory in each plugin so it can run svn update. That obviously won't work for git checkouts whether or not their .git folder has been removed. You should edit that script and send them a patch to enable the git version of update. It would probably be a pretty simple change.
.git folder is removed so that it doesn't get checked into your own SCM. For example, not everyone's using Git as their SCM (me for one) and wouldn't want to check in .git repos into my own for obvious reasons.
According to the help spat out by script/plugin, -x option would add SVN external. I found these two articles addressing this specific issue, but haven't tried solutions since I don't use .git
Related
I am setting up Jenkins job to automatically store jenkins configuration (content of JENKINS_HOME directory) in SVN repository.
I decided to use commandline options as it seems most straightforward, and available plugins i investigated are to be adopted or deprecated.
Is there a way to indicate svn the folder path and tell it to:
add and commit new files that appeared in the folder since last commit
commit updated files that have changed since last commit
ignore files - i figure that i should manually add files i want to ignore to
ignore list e.g. through SVNTortoise..
I could also accept that all files that are not ignored are added and commited. So svn can overwrite all files in the repository by the version in Jenkins home directory.
Is following a good solution?
svn add --force path_to_jenkins_home
svn commit path_to_jenkins_home -m "message"
svn add, which handle all (AFAICR) edge-cases and add only needed things
svn add --force --auto-props --parents --depth infinity -q *
I have added some files to .gitignore, then run the command git clean -options to clean some untracked files. (Sorry, I don't remember what options I used). Then, Rubymine can't load all files in my projects. I open the project source tree, and all I can see are the following files .gitignore, Gemfile, Gemfile.lock, Readme.md, and some other unimportant files. I think the problem occurs because of the git command I use above. I am wondering if anybody has faced this problem before. Any suggestions are appreciated.
Check this, hope this may save you
git reflog it is explained here
http://gitready.com/intermediate/2009/02/09/reflog-your-safety-net.html
Also remember you can always go back to your previous stable commit git checkout [revision] or undoing your changes.
https://www.atlassian.com/git/tutorials/undoing-changes
I decided to learn how to use Version Control over Christmas break, so I downloaded Git, opened a GitHub account and started reading the online tutorial linked to from the GitHub website. When I got to this part http://progit.org/book/ch2-2.html I got stuck because I wasn't sure how to add files. For instance, I tried
git add C:/Finish.txt
And it said
Fatal: 'C:/Finish.txt' is outside repository
I was confused until I remember that a long time ago I had tried teaching myself Ruby on Rails and played around with Git back then. It never really went anywhere, but there's all this residual stuff floating around my system and I don't know how to change it. For instance, my Untracked files (which should be empty) are rails_projects/ and sample/.
How can I just erase all the old stuff and start over?
You should make a folder for your repository, move Finish.txt to that repository, then do git add.
For example:
# here you create C:\myrepo
cd C:\myrepo
git init .
# here you edit C:\myrepo\Finish.txt
git add Finish.txt
git commit -m "Added Finish.txt"
Start a new repository, e.g.
c:
md c:\newrepo
cd c:\newrepo
git init .
copy \Finish.txt .
git add Finish.txt
git commit -m "started over"
I strongly recommend against adding anything to C:\, let alone putting a git repo there. Unless of course you want to accidentally add all of your system disk to git :)
I can also heartily recommend using TortoiseGit which has some excellent explorer integration.
Delete any .git folder that you find in your drive.
To create a repo go to a folder that you want the repo in ( and not just randomly), do:
git init
Then proceed... Add only files that you put within this repo and not randomly from some location.
It would be very unusual to have the root directory of your hard drive be a git repository. That's probably why it's giving you the error.
git repositories are typically in a subdirectory and that subdirectory is typically a project.
To initialize a subdirectory as a git repository, you'd do:
git init (directory)
Then you'd add your files and commit.
I installed the table_builder plugin from https://github.com/p8/table_builder, followed the directions at the bottom titled For a pre rails 3.0 table_builder: which works great.
The problem is since I checked out a branch of it, when I try to commit this to MY GIT repo, it doesnt think there are files even there.. git status diplays nothing, git add wont add the files..
Any suggestions as to how I can get this committed?
Maybe you cloned the plugin directly into your own repository and you now have the plugin repository within your repository?
A git repository will by default ignore any other repositories and their working directories that are located within it.
If so, you have (at least) two options:
Clone the plugin elsewhere, and then
copy the necessary files into your
repository
Clone the plugin into your repository
and then delete the plugin's .git
folder
There are other ways to manage this with git-submodule but I'm not an expert on that so I defer to someone with more knowledge.
Check the .gitignore file in your project root folder. If git status doesn't see the files and git add won't add them, it's most likely because they're being specifically ignored.
My rails app is in a svn repository, but several of the plugins are installed through git and later added to the svn repo. How can I update these plugins? I can't seem to get script/plugin update to do anything. I'd really like to update activemerchant to get rid of the Inflector warnings.
If you haven't made any local changes to the plugin and you don't need to track what changes to it the update will bring, you can just run script/plugin install again, passing in --force if you need to. For example:
script/plugin install --force git://github.com/dchelimsky/rspec.git
If you already have a static copy of a plugin checked into Subversion, it can be a pain to update it via script/plugin, so here's what I end up doing in order to switch it from a static install to a Git checkout all within one Subversion commit:
git clone git://github.com/foo/bar.git ~/foobar
mv ~/foobar/.git rails_app/vendor/plugins/foobar/.git
rm -rf ~/foobar
cd rails_app/vendor/plugins
git reset --hard
Then make sure to add .git and everything else that has changed to the Subversion project and you will be all up-to-date. You can use other git commands to pull down updates, move to a different branch, etc. Then just check things in again once they are at the state that you want.
One thing I do in this case, I remove the plugin directory then I commit to SVN, this will remove the old plugin in the repo. (I usually moved it in a tmp directory, just in case and delate it later once the new one is working fine)
I then reinstall the new version of the plugin, and commit again.
Easy.
You should just be able to navigate to the plugin's directory and hit:
git pull
. I'm pretty sure that script/install plugin just checks the code out from the git repo.
In order for Git to be able to recognise the repository as a Git repository, you will need to add the .git subdirectory and everything under it to Subversion as well. Otherwise, the plugin will just look like another pile of source code and Git will say it's "Not a Git repository".
Ran into the same situation and used this solution: had paperclip installed as a plugin sitting in an svn repo as part of my app. Now I wanted to use the latest version instead and didnt change a bit of the paperclip plugin so I could easyly remove it from the app/svn and install it as a gem instead. done.