heh i was scourging the entire internets for this exact screencast last night. thanks!
Git does look pretty good, but so far subversion has done everything I have needed it to.
Hearing good things about GIT for quiet some time but, lack of windows support is holding us back.
till we get some native binaries(not cygwin), we would remain with subversion.
I use the following little "git-rails" script to take a new Rails project and initialise it as a git repository.
#!/bin/sh
git init
cat <<EOF > .gitignore
.DS_Store
log/*.log
tmp/**/*
db/*.sqlite3
coverage
doc/app/*
EOF
find . -type d -empty -exec touch {}/.gitignore \;
git add .
git commit -a -m "Initial import."
Thanks Ryan, another great screencast.
I'd been holding back for the same reason Matt gave. The try-something-new temptation is strong though... so time to give it a try me thinks!
Another great screencast.
One thing, you dont need to use `git add .` if you commit using the -a option. It will automatically add all modified files to the commit.
Martin, I think you are wrong about using "git add .". To add new files to repository (index) you need to use "git add ." before commit.
"git commit -a" only adds modified files that are already part of the repository, not new files. So after "git init", or every time you add new files you should use "git add ."
Yes, sorry. I meant that that "git add ." is only needed the first time for new files and the following times (for existing files) should "git commit -a" be enough.
A future screencast I'd love to see would be about how to do testing when you are using Restful Authentication. I'm missing something (I hope) because it seems to be a bear to do, and your sceencasts always help with those sort of problems.
@Senthil:
Better Git support is built into msysGit:
http://code.google.com/p/msysgit/
Still, lacks git-svn support due perl bindings, but is usable :)
In any case, the steeped learning curve of Git (ala: the bad UI design it has) make me stay away from it and keep using bazaar as SCM.
I feel a little silly asking, but what does ** mean?
Ryan and Pete Yandell (in a comment) used it in their .gitignore files
tmp/**/*
Thanks
@Gav: something/**/* will go down all the subdirectories of 'something' and select all the files inside.
@Ryan, Pete: shouldn't you also ignore the schema.rb?
In my personal experience, git is the best thing that happened to my workflow since rails :)
Prior to getting my new mac, I was on windows and was playing around with a windows port of Git called 'Git Bash'
http://code.google.com/p/msysgit/
and a little installation walkthrough:
http://kerneltrap.org/Linux/Git_on_Windows
--Good luck guys!
I'd highly recommend staying away from braid for the time being. In my experience it's been very buggy and has out and out thrashed a particular project badly enough that I had to re-import it form SVN.
Piston has forthcoming git support, so I'll be waiting for that.
Hi,
I just wanted to quickly point out that you are putting the ".DS_Store" into the wrong .gitignore file, IMHO. You put it into the ToDo app's .gitignore file, but actually it's not specific to the ToDo app, it is specific to your development environment (MacOS X). So, it belongs in your systemwide .gitignore, not the project-specific one.
jwm
Git rocks!
as well as Linux and Linus Torvalds ;)
thanks for this screencast
There's git support for script/generate in edge.
http://dev.rubyonrails.org/changeset/8772
e.g. script/generate -g
Cheers,
Rajesh.
A note to those using Autotest: you might want to add an exception to ignore your '.git' folder, lest you wish Autotest to slow to a halt.
See http://blog.davidchelimsky.net/articles/2008/01/15/rspec-1-1-2-and-zentest-3-8-0
This is also very nice to have it as a reference.
http://zrusin.blogspot.com/2007/09/git-cheat-sheet.html
@Nicolás: how is that different to something/*/* ?
Gav
Should we add schema.rb in the .gitignore?
My .gitignore contains:
db/*
!db/migrate
and also
public/cache/**/*
@Stephen, thanks for the input. I removed Braid from the list of links for now. Looks like Git support for Piston is coming along nicely! Can't wait!
@Jörg, I agree, excellent point!
@Gavin, I believe ** will traverse the directory to multiple depth, but someone please correct me if I'm wrong.
@devon, I like to keep my schema.rb file under version control so if someone downloads the projects they can just run db:schema:load rather than running all the migrations. The comments at the top of schema.rb file recommend doing this as well.
There's a pretty comprehensive git textmate bundle available:
http://blog.macromates.com/2008/git-bundle/
Make sure you set the TM_GIT textmate environment variable to the path of your git binary (/opt/local/bin/git for macports for example)
Used to work with CVS, got really excited with SVN as replacement, but as linus said, they got it all wrong from the begining....
it's not a technical screencast, but I recomand that video http://www.youtube.com/watch?v=4XpnKHJAok8
a bit long, but very interresting, fun presentation at google talks
Any IDE supports GIT to check-in check-out directly like RADRAILS supports SVN
You might not always want to use the -a option with commits.
I like the power of the index just having the state of the files when they were added. Using the -a option means that the index is updated with the current state of the file.
I have to admit I was a little confused about adding vs. the "-a" option vs. the index. And comments (in the Peepcode) about git tracking "content", not "files". Whaaaaa.
An article by Ryan Tomayko cleared it all up for me. It's a little more advanced. You might not need his actual technique, but it illuminates the topic of "adding".
http://tomayko.com/writings/the-thing-about-git
anyone know if there is a plugin for git that i can use for eclipse? i've gotten used to right-click -> commit and team -> revert etc. and doing those things on the command line feels like a step backwards...
Git looks great, but can it work with deprec/capistrano/mongrel as well as subversion does?
As of this moment GiT users face the same problem that every earlier adopter does, a lack of compatibility and support in most ancillary tools. This, however will change over time and the decision of when to move to GiT may well be heavily influenced by what tool is considered most important.
In our case we recently moved from Trac to Redmine because we decided that the VCS was a more vital technology to our future efforts than the Project Administration System. As Trac support for GiT is very minimal and has not, to my recent knowledge, been slated for core implementation we decided to move PAS as well as VCS. Others will decide to stay on Subversion until their desired tools provide better support for GiT.
I have found GiT's UI, for the most part, simple and straight forward to use. I have zero experience with the the GUI's available but the command line instructions could ahrdly be simpler.
The whole structure of GiT is a marvel to consider. The insight of the designer is, for me, dumbfounding. One must consider that this entire project is really nothing more than an innovative combination of tools that have been present on most Linux distributions for years.
GiT's innovations have tremendous possibilities for OS fs security and data compaction in future Linux distributions. I believe that GiT is going to radically change computing. Consider the value of knowing simply by looking at the SHA1 value of the system whether or not any file in /etc or /var/share or /usr/local has been changed or needs to be updated!
The SVN folks themselves have conceded that the OOS community mind-share has committed to DVCS and that SVN will likely be the end of the line for centralized repository systems in OSS. Whether this means that GiT will be "THE" OSS DVCS is another issue.
Hi Ryan,
Thanks for your great rails screencasts.
I've small tip for the people who use "vim" as code editor. If you want to exclude ".swp" files, just add "*.swp" to your ".git/info/exclude" file.
for those that use capistrano, and had followed this screencast, make sure you DO NOT add the log/*.log and config/database.yml to your .gitignore file.
Capistrano will spit out error messages when you begin to migrate your db.
Learn from me :-)
Hi all,
I've tried out some cases for the .gitignore file. How this file have to be if I would exclude all file except two?
# .gitignore
*
!days.txt
!directory
But if I add a file to directory I get a message, that I have to use git add -f to add to the staging area. Could anyone help me?
@nerb -
If you use Capistrano, it pays to exclude the log files and database.yml from git, then create the files in the shared/ folder (that is shared between different releases) and then symlink them into your project.
The benefits of excluding those files from source control are huge when you have a handful of developers, each with a different machine configuration.
@nerb - A quick follow up. Add this to your deploy.rb:
task :after_update_code, :roles => [:web, :db, :app] do
run "ln -nfs #{deploy_to}/#{shared_dir}/config/database.yml #{release_path}/config/database.yml"
end
Simple question for noob.
I am trying to figure out the correct url for my capistrano deploy script for the local git repo this sc uses.
"git://localhost:3000/.git"?
Whatever i try gives me errors. I am on Leopard.
@Dnew: Try 'set :repository, "file:///Users/[path to project]/.git"'
Thanks for this great screencast. After seeing it, some might want to go to this short tuto I wrote. It explains why git is so useful and how to use it along with github and an open source project:
http://harryseldon.thinkosphere.com/2008/11/08/grand-gardening-with-git
(My name contains the active link)
One small suggestion to Pete's suggested script. I move the find script that inserts .gitignore into blank dirs BEFORE running git init. This avoids placing .gitignores into the .git directory. Harmless but not very clean.
Here's the gist
http://gist.github.com/141509
How do you automatically add new files? What is the point of adding a directory if the directory isn't monitored for new files?
Yes, sorry. I meant that that "git add ." is only needed the first time for new files and the following times (for existing files) should "git commit -a" be enough...
I just wanted to quickly point out that you are putting the ".DS_Store" into the wrong .gitignore file, IMHO. You put it into the ToDo app's .gitignore file, but actually it's not specific to the ToDo app, it is specific to your
A note to those using Autotest: you might want to add an exception to ignore your '.git' folder
I like computer.I want to learn more about it.You help me at the computer language.Thank you.Have a good time.Merry Christmas!
Yes, sorry. I meant that that "git add ." is only needed the first time for new files and the following times (for existing files) should "git commit -a" be enough...
I had installed git a while back, but hadn't done anything with it. However, after fussing with Subversion branching/merging - I had fresh initiative to use git. This screencast really demonstrates ease in which to setup a rails project under git.
Thanks Ryan, you are providing a valuable service with RailsCasts!
The new Rails 3 binary will actually automagically create all the bare necessary .gitignore and .gitkeep files you may need. It does this by default, but you can opt-out of creating them by passing -G as an option on the command line.
Hey guys,
I hope this allowed, I have never used this website before so I wasn't really sure what this was going to do. So this is just a test post. I really like this forum, it has some excellent discussions that take place.
This is an excellent article, thank you very much for it,
I have found here much useful information in
http://ambienbuy.net/VALIUM.html
If I'm repeating someone above, feel free to delete this, but instead of creating .gitignore files in the directories you want to add to the repo, you can just add them with:
git add -f tmp log vendor
Thank you How do you automatically add new files? What is the point of adding a directory if the directory isn't monitored for new files?
Thanks for the heads up. Google are definitely planning something even bigger than just an internet connection and additional smart-phones.
hey buddy,this is one of the best posts that I’ve ever seen; you may include some more ideas in the same theme. I’m still waiting for some interesting thoughts from your side in your next post.
<a href="http://www.gucciusaoutlet.com" target="_blank"><strong>designer handbags Gucci</strong></a>
http://www.gucciusaoutlet.net/index.php?main_page=index&cPath=77&zenid=aa7cf3c1c03ba16b9ac00c8cd2a23ef2
<a href="http://www.gucciusaoutlet.com" target="_blank"><strong>designer handbags Gucci</strong></a>
http://www.gucciusaoutlet.net/index.php?main_page=index&cPath=77&zenid=aa7cf3c1c03ba16b9ac00c8cd2a23ef2
Took me time to read all the comments, but I really enjoyed the article. It proved to be Very helpful to me and I’m sure to all of the commenters right here! I bet you had enjoyable scripting this article, didn’t you?
Nice website! Truly impressive and nice information. Thanks for sharing.
Buy classic and cheap chanel shoes from us is the most right choice for you.Free shipping and fast delivery.Welcome.
I am happy to find a beautiful post for me. Now I am planing to leave for sleeping. I hope you will add that. Thanks
Thanks for this great post, i like this article very informative.
Wow thanks for the article! Please keep writing article's like these, I really liked it!
I am totally agree with your oppinion.this blog post is very encouraging to people who want to know these topics.
If God would exists it will be you... very thanks for this screencast.
it is interesting and informative article. This has been very helpful understanding a lot
of things. I’m sure a lot of other people will agree with me.
lots of good advice on your post. and as a return,i will buy a Cheap nfl jerseys to you for my thanking.
Awesome post! Thanks for sharing such nice information with us. I am really interested in this learning about this. , I feel strongly about information and love learning more on this. Thanks for the information. This is a wonderful post!!
winni2078 08 23
<a href="http://www.juicycouture4u.com/">juicy couture </a>
http://www.juicycouture4u.com/
[url=http://www.juicycouture4u.com]Juicy Couture [/url]
Thanks for sharing your article. I really enjoyed it. I put a link to my site to here so other people can read it. My readers have about the same interets
Unfortunately this happens a lot. I my self have been a victim of abuse from TFL staff a number of times. I prefer to pay for my travelcards useing the automated machines so i won't have my oyster card and change thrown at me.
Wholesale cheap prom dresses
Wholesale Wedding Dresses
Wholesale Prom Dresses
Wholesale bridesmaid Dresses
Welcome to visit my website: http://www.sistersdress.com
--- Online wholesale shop offering discount designer prom dresses, cheap designer wedding dresses, cheap bridesmaid dresses,plus size wedding dresses, short prom dresse. You can choose any dress you like.
Beautiful dress! Welcome to visit my website: http://www.sistersdress.com
--- Online wholesale shop offering discount designer prom dresses, designer wedding dresses, cheap bridesmaid dresses,plus size wedding dresses, short prom dresse. You can custom any dresses you like.
When I saw the title of this article, I was deeply attracted.What's more, the content of this article is more wonderful and hope to see more articles from this writer.
Thanks for sharing your article. I really enjoyed it. I put a link to my site to here so other people can read it. My readers have about the same interets






