Git Tips, Tricks and Questions #1

So you have a rails app and you need to remove all references to a particular resource (model, controller, views, tests etc.) from Git on the command line in one nice simple command?

Easy…

git commit *resourcename* -m "deleting all references to resourcename"
[master 29bf6e1] deleting all references to resourcename
9 files changed, 0 insertions(+), 161 deletions(-)
delete mode 100644 app/controllers/resourcenames_controller.rb
delete mode 100644 app/helpers/resourcenames_helper.rb
delete mode 100644 app/models/resourcename.rb
delete mode 100644 app/views/resourcenames/new.html.erb
delete mode 100644 app/views/resourcenames/show.html.erb
delete mode 100644 test/fixtures/resourcenames.yml
delete mode 100644 test/functional/resourcenames_controller_test.rb
delete mode 100644 test/unit/helpers/resourcenames_helper_test.rb
delete mode 100644 test/unit/resourcename_test.rb

(where resroucename is the name of your resource obviously)

Done!

Advertisements

About distinctinteractive

I graduated 3 years ago from the University of Huddersfield with a 2:1 BA in Interactive Multimedia. After leaving University i worked for a small company in Huddersfield (Offroad Code) mainly helping to maintain a large travel company website. I am currently freelancing as Distinct Interactive. Follow me on Twitter @jimmckerchar
This entry was posted in Git, Programming, RoR and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s