You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<h1id="command-line-cheat-sheet">Command Line Cheat Sheet<aclass="headerlink" href="#command-line-cheat-sheet" title="Permanent link">¶</a></h1>
1236
1236
<p>See also <ahref="https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax">GitHub's Markdown Guide</a>.</p>
1237
-
<h2id="useful-bash-emacs-and-git">Useful bash, emacs, and git:<aclass="headerlink" href="#useful-bash-emacs-and-git" title="Permanent link">¶</a></h2>
<pclass="admonition-title">Pro tip: Simplify your git history</p>
1337
+
<ul>
1338
+
<li>Use <code>git mv</code> to rename a file so that it is tracked as a rename (with or without changes). </li>
1339
+
<li>If you rename a file then <code>git add</code> its parent directory, the diff will show the deletion of the original file and addition of a "completely new" file, even if nothing has changed. This makes reviewing changes much more complicated than necessary.</li>
<p>After making changes to a file on a branch, check the status of your current working branch (with <code>git status</code>). Then, you "add" the file, state what is new about the file ("commit the change"), and <code>push</code> the file from your local copy of the repo to the remote copy:</p>
<pclass="admonition-title">Pro tip: Check the stage</p>
1352
+
<p>After using <code>git add <folder></code> or <code>git add <regex></code> (a pattern match), run <code>git status</code> to ensure that all intended files--and <strong><em>only</em></strong> intended files--are staged for commit.</p>
1353
+
</div>
1343
1354
<divclass="admonition note note">
1344
1355
<pclass="admonition-title">Note</p>
1345
1356
<p>If you need to update your branch with changes from the remote <code>main</code>, first switch to the branch, then set pull from <code>main</code> instead of the current branch, as below.
0 commit comments