O'Reilly logo

Pragmatic Version Control Using Git by Travis Swicegood

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Managing Files

Now your repository is starting to come together. With one file, it’s pretty simple right now, but as it grows, some cleanup is necessary.

Files need moving, code needs to be copied around, and some of the everyday cruft from working with your project needs to be ignored.

Renaming and Moving Files

We all write flawless, bug-free code on our first pass. Right? Even though we would like to think that we do, we sometimes get things wrong. Naming a file incorrectly or putting it in the wrong directory is no exception.

You can move a file in Git by typing git mv <original-file> <new-file>. The command tells Git to create new-file with the existing file’s content, and it keeps the history and removes original-filename.

Your “Hello ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required