<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">\documentclass[onecolumn,letterpaper,11pt]{article}

%===================================================================
\input{common_latex/common_latex_packages}
\input{common_latex/common_latex_definitions}
\input{common_latex/common_latex_help_format}
%===================================================================

\begin{document}

\begin{labcover}
\labtitle{Help Topic: The Git Move Command}
\vspace{0.1in}
\labdate{Fall 2024}
\vspace{0.1in}
\labauth{Michael Benjamin, mikerb@mit.edu}
\labauth{Oscar Viquez, oviquezr@mit.edu}
\labauth{Department of Mechanical Engineering}
\labauth{MIT, Cambridge MA 02139}
\labline
\end{labcover}

\wikidoc{file=Help.GitMove}
\wikidoc{auth=mikerb@mit.edu}

%====================================================================
\section*{The Git \cmd{mv} Command}
%====================================================================

The \cmd{git mv} command allows you to change the name of a file or
directory in a locally checked out repository while retaining the
history of the file or directory.  More info on \cmd{git mv} can
always be found by Googling "Git book" and reading the full PDF
online free, or just typing \cmd{git help mv} anytime on the command
line.

%---------------------------------------------------------------------
\subsection*{Basic usage of the \cmd{git mv} command}

The basic syntax for the \cmd{git mv} command is:

\vspace{0.05in}
\begin{consoleverb}
 $ git mv alpha.cpp bravo.cpp
 On branch master
 Your branch is up to date with 'origin/master'.

 Changes to be committed:
   (use "git restore --staged &lt;file&gt;..." to unstage)
     renamed:    alpha.cpp -&gt; bravo.cpp
\end{consoleverb}
\vspace{0.15in}

\noindent
The \cmd{git mv} command does {\em not} require a network connection
to the server and only declares an intention to make a set of changes
to the master copy on the Git server upon the next commit.

% \pskip
% \noindent
% It may seem that invoking \cmd{git mv} is the same as:

% \vspace{0.05in}
% \begin{consoleverb}
%  $ cp alpha.cpp bravo.cpp
%  $ git add bravo.cpp
%  $ git rm alpha.cpp
% \end{consoleverb}
% \vspace{0.15in}

% \noindent
% When done this way, the history of changes to \var{alpha.cpp} will be
% lost.  If you were to invoke \cmd{git log bravo.cpp}, you would only
% see one entry, and perhaps lose valuable log information about who and
% what changed in \var{alpha.cpp} over time. By using \cmd{git mv} this
% log history is retained and carried over to \var{bravo.cpp}.

\end{document}

</pre></body></html>