What's Best Practice when you change your script's name?

Being a technical writer, not a programmer, I will often write script
with names that make sense to me while I’m working on them, but then
later decide the script really needs to be renamed. Before I got
involved with using git for version control, I would just rename my
scripts if I decided I didn’t like the name. With Git (or any other
version control software), I’m wondering what others think is a best
practice. Is it to just rename it on github, then pull it again locally?
or should I change it locally and push out to github, or does it really
matter?

Note: I know this really is fringe material for the Ruby list, but I’m
hoping that since I’m trying to get more of a best practice type of
question, folks don’t take an exception to me posting it here.

Wayne

On Mon, Feb 10, 2014 at 4:06 PM, Wayne B. [email protected]
wrote:

Being a technical writer, not a programmer, I will often write script with
names that make sense to me while I’m working on them, but then later decide
the script really needs to be renamed. Before I got involved with using git
for version control, I would just rename my scripts if I decided I didn’t
like the name. With Git (or any other version control software), I’m
wondering what others think is a best practice. Is it to just rename it on
github, then pull it again locally? or should I change it locally and push
out to github, or does it really matter?

Git tracks the contents of the files, so it’s able to follow a rename
perfectly fine.
For example, I created a file called test.txt, and commited it. Later,
I renamed it to renamed.txt, and added it (I also had to git rm
test.txt), the result was:

$ git status

On branch master

Changes to be committed:

(use “git reset HEAD …” to unstage)

renamed: test.txt -> renamed.txt

Jesus.

Thanks all! Just wanted to make sure I didn’t end up hosing myself by
doing the wrong thing.

Wayne


From: Eric MSP Veith [email protected]
To: Ruby users [email protected]
Sent: Monday, February 10, 2014 9:58 AM
Subject: Re: What’s Best Practice when you change your script’s name?

On Monday 10 February 2014 16:40:34, Jess Gabriel y Galn
[email protected] wrote:

Git tracks the contents of the files, so it’s able to follow a rename
perfectly fine.

If you (the OP) are interested in the actual background and sementics,
you can
read a question on Stack Exchange regarding this at
http://stackoverflow.com/questions/1094269/whats-the-purpose-of-git-mv,
which explains that “git mv” exists and is actual a shortcut for “mv
$old
$new; git rm $old; git add $new”.

There’s a git faq entry at
https://git.wiki.kernel.org/index.php/GitFaq#Why_does_Git_not_.22track.22_renames.3F,
and a lengthy explanation by Linus at
http://permalink.gmane.org/gmane.comp.version-control.git/217.

The short answer is exactly what Jesus said: Git tracks contents, not
files.

HTH.

— Eric

On Monday 10 February 2014 16:40:34, Jess Gabriel y Galn
[email protected] wrote:

Git tracks the contents of the files, so it’s able to follow a rename
perfectly fine.

If you (the OP) are interested in the actual background and sementics,
you can
read a question on Stack Exchange regarding this at
http://stackoverflow.com/questions/1094269/whats-the-purpose-of-git-mv,
which explains that “git mv” exists and is actual a shortcut for “mv
$old
$new; git rm $old; git add $new”.

There’s a git faq entry at
https://git.wiki.kernel.org/index.php/GitFaq#Why_does_Git_not_.22track.22_renames.3F,
and a lengthy explanation by Linus at
http://permalink.gmane.org/gmane.comp.version-control.git/217.

The short answer is exactly what Jesus said: Git tracks contents, not
files.

HTH.

  --- Eric

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs