<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://cramsession.net/index.php?action=history&amp;feed=atom&amp;title=Computer_Notes%2FGIT%2FGit_Cheat_Sheet</id>
	<title>Computer Notes/GIT/Git Cheat Sheet - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://cramsession.net/index.php?action=history&amp;feed=atom&amp;title=Computer_Notes%2FGIT%2FGit_Cheat_Sheet"/>
	<link rel="alternate" type="text/html" href="https://cramsession.net/index.php?title=Computer_Notes/GIT/Git_Cheat_Sheet&amp;action=history"/>
	<updated>2026-09-02T10:42:06Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.1</generator>
	<entry>
		<id>https://cramsession.net/index.php?title=Computer_Notes/GIT/Git_Cheat_Sheet&amp;diff=1833&amp;oldid=prev</id>
		<title>Mflavell: Created page with &quot;== Starting a Project == {| class=&quot;wikitable&quot; |- ! Command !! Action |- | &lt;code&gt;git init&lt;/code&gt; || Initialize a new local Git repository |- | &lt;code&gt;git clone &amp;lt;url&amp;gt;&lt;/code&gt; || Download a repository from a remote server |}  == Staging &amp; Committing == {| class=&quot;wikitable&quot; |- ! Command !! Action |- | &lt;code&gt;git status&lt;/code&gt; || Show modified, untracked, and staged files |- | &lt;code&gt;git add &amp;lt;file&amp;gt;&lt;/code&gt; || Stage a specific file |- | &lt;code&gt;git add .&lt;/code&gt; || Stage a...&quot;</title>
		<link rel="alternate" type="text/html" href="https://cramsession.net/index.php?title=Computer_Notes/GIT/Git_Cheat_Sheet&amp;diff=1833&amp;oldid=prev"/>
		<updated>2026-08-31T17:08:52Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;== Starting a Project == {| class=&amp;quot;wikitable&amp;quot; |- ! Command !! Action |- | &amp;lt;code&amp;gt;git init&amp;lt;/code&amp;gt; || Initialize a new local Git repository |- | &amp;lt;code&amp;gt;git clone &amp;lt;url&amp;gt;&amp;lt;/code&amp;gt; || Download a repository from a remote server |}  == Staging &amp;amp; Committing == {| class=&amp;quot;wikitable&amp;quot; |- ! Command !! Action |- | &amp;lt;code&amp;gt;git status&amp;lt;/code&amp;gt; || Show modified, untracked, and staged files |- | &amp;lt;code&amp;gt;git add &amp;lt;file&amp;gt;&amp;lt;/code&amp;gt; || Stage a specific file |- | &amp;lt;code&amp;gt;git add .&amp;lt;/code&amp;gt; || Stage a...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Starting a Project ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Command !! Action&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;git init&amp;lt;/code&amp;gt; || Initialize a new local Git repository&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;git clone &amp;amp;lt;url&amp;amp;gt;&amp;lt;/code&amp;gt; || Download a repository from a remote server&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Staging &amp;amp; Committing ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Command !! Action&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;git status&amp;lt;/code&amp;gt; || Show modified, untracked, and staged files&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;git add &amp;amp;lt;file&amp;amp;gt;&amp;lt;/code&amp;gt; || Stage a specific file&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;git add .&amp;lt;/code&amp;gt; || Stage all modified and new files&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;git add -f &amp;amp;lt;file&amp;amp;gt;&amp;lt;/code&amp;gt; || Force-stage a file ignored by .gitignore&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;git commit -m &amp;quot;message&amp;quot;&amp;lt;/code&amp;gt; || Save staged snapshot with a description&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;git commit -am &amp;quot;message&amp;quot;&amp;lt;/code&amp;gt; || Stage tracked changes and commit in one step&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Branching &amp;amp; Merging ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Command !! Action&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;git branch&amp;lt;/code&amp;gt; || List all local branches&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;git branch &amp;amp;lt;name&amp;amp;gt;&amp;lt;/code&amp;gt; || Create a new branch&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;git switch &amp;amp;lt;name&amp;amp;gt;&amp;lt;/code&amp;gt; || Switch to an existing branch&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;git switch -c &amp;amp;lt;name&amp;amp;gt;&amp;lt;/code&amp;gt; || Create and switch to a new branch&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;git merge &amp;amp;lt;branch&amp;amp;gt;&amp;lt;/code&amp;gt; || Merge target branch into active branch&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;git branch -d &amp;amp;lt;name&amp;amp;gt;&amp;lt;/code&amp;gt; || Delete a merged branch&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Syncing &amp;amp; Remotes ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Command !! Action&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;git remote add origin &amp;amp;lt;url&amp;amp;gt;&amp;lt;/code&amp;gt; || Link local repository to a remote URL&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;git fetch&amp;lt;/code&amp;gt; || Download remote changes without merging&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;git pull&amp;lt;/code&amp;gt; || Fetch and merge changes from remote repository&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;git push -u origin &amp;amp;lt;branch&amp;amp;gt;&amp;lt;/code&amp;gt; || Upload commits and set default remote branch&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;git push&amp;lt;/code&amp;gt; || Upload commits to linked remote branch&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Viewing History &amp;amp; Files ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Command !! Action&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;git log --oneline&amp;lt;/code&amp;gt; || View condensed commit history&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;git diff&amp;lt;/code&amp;gt; || Show changes made to unstaged files&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;git diff --staged&amp;lt;/code&amp;gt; || Show changes staged for the next commit&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;git ls-files&amp;lt;/code&amp;gt; || List all files currently tracked by Git&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Undoing Changes ==&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Command !! Action&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;git restore &amp;amp;lt;file&amp;amp;gt;&amp;lt;/code&amp;gt; || Discard uncommitted changes in a file&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;git restore --staged &amp;amp;lt;file&amp;amp;gt;&amp;lt;/code&amp;gt; || Unstage a file without losing changes&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;git reset HEAD~1&amp;lt;/code&amp;gt; || Undo last commit, keeping changes locally&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;git reset --hard HEAD~1&amp;lt;/code&amp;gt; || Permanently discard last commit and all work&lt;br /&gt;
|-&lt;br /&gt;
| &amp;lt;code&amp;gt;git commit --amend&amp;lt;/code&amp;gt; || Add staged changes to or edit the last commit&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Mflavell</name></author>
	</entry>
</feed>