Questions tagged [rename]

For anything regarding renaming. Could be applicable to a wide range of subjects. Should be replaced by a more domain-specific tag if applicable.

Questions regarding renaming one or many files, directories, projects, variables, users, data cells, and version control conflicts arising from renaming should be tagged with rename.

To rename a file means to give an existing file a new name without changing any of its content. In UNIX systems, this is done with the mv command.

Renaming a variable will usually require a find-and-replace edit in existing code.

5438 questions
2886
votes
36 answers

Renaming column names in Pandas

I want to change the column labels of a Pandas DataFrame from ['$a', '$b', '$c', '$d', '$e'] to ['a', 'b', 'c', 'd', 'e']
user1504276
  • 28,955
  • 3
  • 15
  • 7
1569
votes
32 answers

How can I rename a database column in a Ruby on Rails migration?

I wrongly named a column hased_password instead of hashed_password. How do I update the database schema, using migration to rename this column?
user1994764
  • 15,889
  • 5
  • 19
  • 11
1475
votes
20 answers

How do I rename both a Git local and remote branch name?

I have a local branch master that points to a remote branch origin/regacy (oops, typo!). How do I rename the remote branch to origin/legacy or origin/master? I tried: git remote rename regacy legacy But this gave an error: error : Could not…
JayD
  • 15,483
  • 5
  • 15
  • 14
1136
votes
46 answers

How do I rename a MySQL database (change schema name)?

How do I quickly rename a MySQL database (change its schema name)? Usually I just dump a database and re-import it with a new name. This is not an option for very big databases. Apparently RENAME {DATABASE | SCHEMA} db_name TO new_db_name; does bad…
deadprogrammer
  • 11,253
  • 24
  • 74
  • 85
991
votes
13 answers

In a Git repository, how to properly rename a directory?

I think it should work to copy the directory to be renamed to a new directory with desired name, and delete the old directory, and git add, git commit and push everything. But is this the best way?
qazwsx
  • 25,536
  • 30
  • 72
  • 106
837
votes
14 answers

Is it possible to move/rename files in Git and maintain their history?

I would like to rename/move a project subtree in Git moving it from /project/xyz to /components/xyz If I use a plain git mv project components, then all the commit history for the xyz project gets lost. Is there a way to move this such that the…
sgargan
  • 12,208
  • 9
  • 32
  • 38
776
votes
20 answers

Rename a file in C#

How do I rename a file using C#?
Gold
  • 60,526
  • 100
  • 215
  • 315
695
votes
12 answers

How do you change the capitalization of filenames in Git?

I am trying to rename a file to have different capitalization from what it had before: git mv src/collision/b2AABB.js src/collision/B2AABB.js fatal: destination exists, source=src/collision/b2AABB.js, destination=src/collision/B2AABB.js As you can…
knpwrs
  • 15,691
  • 12
  • 62
  • 103
682
votes
12 answers

How do I completely rename an Xcode project (i.e. inclusive of folders)?

I have a project named XXX. I want to rename this project to YYY. Note that XXX is an extremely common term (for e.g. "data", or simply "project"), and thus a simple RegEx search-and-replace is not possible, out of risk of corrupting the project…
Vatsal Manot
  • 17,695
  • 9
  • 44
  • 80
556
votes
28 answers

How do I rename the extension for a bunch of files?

In a directory, I have a bunch of *.html files. I'd like to rename them all to *.txt How can I do that? I use the bash shell.
bmw0128
  • 13,470
  • 24
  • 68
  • 116
478
votes
36 answers

JavaScript: Object Rename Key

Is there a clever (i.e. optimized) way to rename a key in a javascript object? A non-optimized way would be: o[ new_key ] = o[ old_key ]; delete o[ old_key ];
Jean Vincent
  • 11,995
  • 7
  • 32
  • 24
477
votes
19 answers

Changing column names of a data frame

I have a data frame called "newprice" (see below) and I want to change the column names in my program in R. > newprice Chang. Chang. Chang. 1 100 36 136 2 120 -33 87 3 150 14 164 In fact this is…
Son
  • 5,295
  • 5
  • 19
  • 10
464
votes
7 answers

How to rename a table in SQL Server?

The SQL query that I have used is : ALTER TABLE oldtable RENAME TO newtable; But, it gives me an error. Server: Msg 156, Level 15, State 1, Line 1 Incorrect syntax near the keyword 'TO'.
Switch
  • 14,783
  • 21
  • 69
  • 110
442
votes
10 answers

Renaming branches remotely in Git

If there is a repository that I only have git:// access to (and would usually just push+pull), is there a way to rename branches in that repository in the same way that I would do locally with git branch -m?
kdt
  • 27,905
  • 33
  • 92
  • 139
409
votes
18 answers

Renaming a branch in GitHub

I just renamed my local branch using git branch -m oldname newname but this only renames the local version of the branch. How can I rename the one on GitHub?
enchance
  • 29,075
  • 35
  • 87
  • 127
1
2 3
99 100