Skip to content

Instantly share code, notes, and snippets.

@TheBeege
Created August 17, 2020 12:51
Show Gist options
  • Save TheBeege/d215456e39a4690d1320cc483c2e1f72 to your computer and use it in GitHub Desktop.
Save TheBeege/d215456e39a4690d1320cc483c2e1f72 to your computer and use it in GitHub Desktop.
Command Line from Code Seoul Git Class on 2020-08-16
;; This is a dump from the class. I had to manually re-format some of it
;; because Windows Command Prompt sucks. So if some things don't look
;; quite like your actions, don't be alarmed.
;; If anything is unclear, please comment here or send us a message
;; on Discord: https://discord.gg/HFknCs8
C:\Users\draco\new_git_class>dir
Volume in drive C has no label.
Volume Serial Number is 94AF5A74
Directory of C:\Users\draco\new_git_class
08/16/2020 01:23 PM <DIR> .
08/16/2020 01:23 PM <DIR> ..
0 File(s)
0 bytes
2 Dir(s) 136,717,148,160 bytes free
C:\Users\draco\new_git_class>cd .
C:\Users\draco\new_git_class>cd ..
C:\Users\draco>cd new_git_class
C:\Users\draco\new_git_class>dir
Volume in drive C has no label.
Volume Serial Number is 94AF-5A74
Directory of C:\Users\draco\new_git_class
08/16/2020 01:23 PM <DIR> .
08/16/2020 01:23 PM <DIR> ..
0 File(s)
0 bytes
2 Dir(s) 136,716,902,400 bytes free
C:\Users\draco\new_git_class>git
usage: git [--version] [--help] [-C <path>] [-c name=value]
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p | --paginate | --no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
<command> [<args>]
These are common Git commands used in various situations:
start a working area (see also: git help tutorial)
clone Clone a repository into a new directory
init Create an empty Git repository or reinitialize an existing one
work on the current change (see also: git help everyday)
add Add file contents to the index
mv Move or rename a file, a directory, or a symlink
reset Reset current HEAD to the specified state
rm Remove files from the working tree and from the index
examine the history and state (see also: git help revisions)
bisect Use binary search to find the commit that introduced a bug
grep Print lines matching a pattern
log Show commit logs
show Show various types of objects
status Show the working tree status
grow, mark and tweak your common history
branch List, create, or delete branches
checkout Switch branches or restore working tree files
commit Record changes to the repository
diff Show changes between commits, commit and working tree, etc
merge Join two or more development histories together
rebase Reapply commits on top of another base tip
tag Create, list, delete or verify a tag object signed with GPG
collaborate (see also: git help workflows)
fetch Download objects and refs from another repository
pull Fetch from and integrate with another repository or a local branch
push Update remote refs along with associated objects
'git help -a' and 'git help -g' list available subcommands and some
concept guides. See 'git help <command>' or 'git help <concept>'
to read about a specific subcommand or concept.
C:\Users\draco\new_git_class>git help init
C:\Users\draco\new_git_class>git init
Initialized empty Git repository in C:/Users/draco/new_git_class/.git/
C:\Users\draco\new_git_class>explorer .
C:\Users\draco\new_git_class>git status
On branch master
No commits yet
nothing to commit (create/copy files and use "git add" to track)
C:\Users\draco\new_git_class>git config --global user.name "Bryan \"Beege\" Berry"
C:\Users\draco\new_git_class>git config --global user.email "draco4king@gmail.com"
C:\Users\draco\new_git_class>git status
On branch master
No commits yet
Untracked files:
(use "git add <file>..." to include in what will be committed)
file.txt
nothing added to commit but untracked files present (use "git add" to track)
C:\Users\draco\new_git_class>git add file.txt
C:\Users\draco\new_git_class>git status
On branch master
No commits yet
Changes to be committed:
(use "git rm --cached <file>..." to unstage)
new file:
file.txt
C:\Users\draco\new_git_class>git commit -m "initial commit"
[master (root-commit) 53c26d2] initial commit
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 file.txt
C:\Users\draco\new_git_class>git status
On branch master
nothing to commit, working tree clean
C:\Users\draco\new_git_class>git log
commit 53c26d2548b68e53b3cf8c9b36fd87ef41b1c03b (HEAD -> master)
Author: Bryan "Beege" Berry <draco4king@gmail.com>
Date: Sun Aug 16 13:38:34 2020 +0900
initial commit
C:\Users\draco\new_git_class>git status
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified:
file.txt
no changes added to commit (use "git add" and/or "git commit -a")
C:\Users\draco\new_git_class>git diff
diff --git a/file.txt b/file.txt
index e69de29..0dc0d5d 100644
--- a/file.txt
+++ b/file.txt
@@ -0,0 +1 @@
+octocat is cool.
\ No newline at end of file
C:\Users\draco\new_git_class>git reset --hard
HEAD is now at 53c26d2 initial commit
C:\Users\draco\new_git_class>git status
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified:
file.txt
no changes added to commit (use "git add" and/or "git commit -a")
C:\Users\draco\new_git_class>git branch
* master
C:\Users\draco\new_git_class>git checkout -b my_new_branch
Switched to a new branch 'my_new_branch'
M file.txt
C:\Users\draco\new_git_class>git branch new_branch
C:\Users\draco\new_git_class>git branch
master
* my_new_branch
new_branch
C:\Users\draco\new_git_class>git checkout master
C:\Users\draco\new_git_class>git branch
master
* my_new_branch
new_branch
C:\Users\draco\new_git_class>git add file.txt
C:\Users\draco\new_git_class>git commit -m "Added octocat."
[my_new_branch 1eeba83] Added octocat.
1 file changed, 1 insertion(+)
C:\Users\draco\new_git_class>git log
commit 1eeba83993c28c7d38d098b9890c9315ac4a37a6 (HEAD -> my_new_branch)
Author: Bryan "Beege" Berry <draco4king@gmail.com>
Date: Sun Aug 16 13:54:44 2020 +0900
Added octocat.
commit 53c26d2548b68e53b3cf8c9b36fd87ef41b1c03b (new_branch, master)
Author: Bryan "Beege" Berry <draco4king@gmail.com>
Date: Sun Aug 16 13:38:34 2020 +0900
initial commit
C:\Users\draco\new_git_class>git checkout master
Switched to branch 'master'
C:\Users\draco\new_git_class>git log
commit 53c26d2548b68e53b3cf8c9b36fd87ef41b1c03b (HEAD -> master, new_branch)
Author: Bryan "Beege" Berry <draco4king@gmail.com>
Date: Sun Aug 16 13:38:34 2020 +0900
initial commit
C:\Users\draco\new_git_class>git diff my_new_branch
diff --git a/file.txt b/file.txt
index ae6e84f..e69de29 100644
--- a/file.txt
+++ b/file.txt
@@ -1 +0,0 @@
-octocat is REALLY cool.
\ No newline at end of file
C:\Users\draco\new_git_class>git merge my_new_branch
Updating 53c26d2..1eeba83
Fast-forward
file.txt | 1 +
1 file changed, 1 insertion(+)
C:\Users\draco\new_git_class>git log
commit 1eeba83993c28c7d38d098b9890c9315ac4a37a6 (HEAD -> master, my_new_branch) Author: Bryan "Beege" Berry <draco4king@gmail.com>
Date: Sun Aug 16 13:54:44 2020 +0900
Added octocat.
commit 53c26d2548b68e53b3cf8c9b36fd87ef41b1c03b (new_branch)
Author: Bryan "Beege" Berry <draco4king@gmail.com>
Date: Sun Aug 16 13:38:34 2020 +0900
initial commit
C:\Users\draco\new_git_class>git branch -d my_new_branch
Deleted branch my_new_branch (was 1eeba83).
C:\Users\draco\new_git_class>git branch
* master
new_branch
C:\Users\draco\new_git_class>git status
On branch master
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified:
file.txt
no changes added to commit (use "git add" and/or "git commit -a")
C:\Users\draco\new_git_class>git add file.txt
C:\Users\draco\new_git_class>git status
On branch master
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified:
file.txt
C:\Users\draco\new_git_class>git commit -m "this is a bad commit"
[master 3524d20] this is a bad commit
1 file changed, 1 insertion(+), 1 deletion(-)
C:\Users\draco\new_git_class>git show 3524d20
commit 3524d201d93d51f27cfe937c5b1a84f4d8e6eb5f (HEAD -> master)
Author: Bryan "Beege" Berry <draco4king@gmail.com>
Date: Sun Aug 16 14:06:13 2020 +0900
this is a bad commit
diff --git a/file.txt b/file.txt
index ae6e84f..bf45eaa 100644
--- a/file.txt
+++ b/file.txt
@@ -1 +1 @@
-octocat is REALLY cool.
\ No newline at end of file
+octocat sucks.
\ No newline at end of file
C:\Users\draco\new_git_class>git log
commit 3524d201d93d51f27cfe937c5b1a84f4d8e6eb5f (HEAD -> master)
Author: Bryan "Beege" Berry <draco4king@gmail.com>
Date: Sun Aug 16 14:06:13 2020 +0900
this is a bad commit
commit 1eeba83993c28c7d38d098b9890c9315ac4a37a6
Author: Bryan "Beege" Berry <draco4king@gmail.com>
Date: Sun Aug 16 13:54:44 2020 +0900
Added octocat.
commit 53c26d2548b68e53b3cf8c9b36fd87ef41b1c03b (new_branch)
Author: Bryan "Beege" Berry <draco4king@gmail.com>
Date: Sun Aug 16 13:38:34 2020 +0900
initial commit
C:\Users\draco\new_git_class>git revert 3524d201d93d51f27cfe937c5b1a84f4d8e6eb5f
[master 062702d] Revert "this is a bad commit"
1 file changed, 1 insertion(+), 1 deletion(-)
C:\Users\draco\new_git_class>git log
commit 062702d4a48ed7cff4c2465125609962b1f74c33 (HEAD -> master)
Author: Bryan "Beege" Berry <draco4king@gmail.com>
Date: Sun Aug 16 14:09:05 2020 +0900
Revert "this is a bad commit"
This reverts commit 3524d201d93d51f27cfe937c5b1a84f4d8e6eb5f.
commit 3524d201d93d51f27cfe937c5b1a84f4d8e6eb5f
Author: Bryan "Beege" Berry <draco4king@gmail.com>
Date: Sun Aug 16 14:06:13 2020 +0900
this is a bad commit
commit 1eeba83993c28c7d38d098b9890c9315ac4a37a6
Author: Bryan "Beege" Berry <draco4king@gmail.com>
Date: Sun Aug 16 13:54:44 2020 +0900
Added octocat.
commit 53c26d2548b68e53b3cf8c9b36fd87ef41b1c03b (new_branch)
Author: Bryan "Beege" Berry <draco4king@gmail.com>
Date: Sun Aug 16 13:38:34 2020 +0900
initial commit
C:\Users\draco\new_git_class>git tag 1.0.0
C:\Users\draco\new_git_class>git show 1.0.0
commit 062702d4a48ed7cff4c2465125609962b1f74c33 (HEAD -> master, tag: 1.0.0)
Author: Bryan "Beege" Berry <draco4king@gmail.com>
Date: Sun Aug 16 14:09:05 2020 +0900
Revert "this is a bad commit"
This reverts commit 3524d201d93d51f27cfe937c5b1a84f4d8e6eb5f.
diff --git a/file.txt b/file.txt
index bf45eaa..ae6e84f 100644
--- a/file.txt
+++ b/file.txt
@@ -1 +1 @@
-octocat sucks.
\ No newline at end of file
+octocat is REALLY cool.
\ No newline at end of file
C:\Users\draco\new_git_class>git tag thisisareallycoolcommit
C:\Users\draco\new_git_class>git remote add origin git@github.com:TheBeege/code_seoul_git_class_2020-08.git
C:\Users\draco\new_git_class>git push -u origin master
Enter passphrase for key '/c/Users/draco/.ssh/id_rsa':
Counting objects: 10, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (10/10), 820 bytes | 205.00 KiB/s, done.
Total 10 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), done.
To github.com:TheBeege/code_seoul_git_class_2020-08.git
* [new branch]
master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.
C:\Users\draco\new_git_class>git remote
origin
C:\Users\draco\new_git_class>git remote -v
origin git@github.com:TheBeege/code_seoul_git_class_2020-08.git (fetch)
origin git@github.com:TheBeege/code_seoul_git_class_2020-08.git (push)
C:\Users\draco\new_git_class>git push
Enter passphrase for key '/c/Users/draco/.ssh/id_rsa':
Everything up-to-date
C:\Users\draco\new_git_class>git pull
Enter passphrase for key '/c/Users/draco/.ssh/id_rsa':
remote: Enumerating objects: 5, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (2/2), done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (3/3), done.
From github.com:TheBeege/code_seoul_git_class_2020-08
062702d..ddfa0de master
-> origin/master
Updating 062702d..ddfa0de
Fast-forward
file.txt | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
C:\Users\draco\new_git_class>cd ..
C:\Users\draco>git clone https://github.com/BetzabethN/code_seoul_git_class_2020-08.git
Cloning into 'code_seoul_git_class_2020-08'...
remote: Enumerating objects: 13, done.
remote: Counting objects: 100% (13/13), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 13 (delta 1), reused 10 (delta 1), pack-reused 0
Unpacking objects: 100% (13/13), done.
C:\Users\draco>cd code_seoul_git_class_2020-08
C:\Users\draco\code_seoul_git_class_2020-08>dir
Volume in drive C has no label.
Volume Serial Number is 94AF-5A74
Directory of C:\Users\draco\code_seoul_git_class_2020-08
08/16/2020 02:43 PM <DIR>
.
08/16/2020 02:43 PM <DIR>
..
08/16/2020 02:43 PM
56 file.txt
1 File(s)
56 bytes
2 Dir(s) 136,715,321,344 bytes free
C:\Users\draco\code_seoul_git_class_2020-08>git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
C:\Users\draco\code_seoul_git_class_2020-08>git log
C:\Users\draco\code_seoul_git_class_2020-08>explorer .
C:\Users\draco\code_seoul_git_class_2020-08>git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
C:\Users\draco\code_seoul_git_class_2020-08>cd ..\new_git_class
C:\Users\draco\new_git_class>git status
On branch master
Your branch is up to date with 'origin/master'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
.gitignore
nothing added to commit but untracked files present (use "git add" to track)
C:\Users\draco\new_git_class>git add .gitignore
C:\Users\draco\new_git_class>git commit -m "Added .gitignore"
[master 51738b8] Added .gitignore
1 file changed, 2 insertions(+)
create mode 100644 .gitignore
C:\Users\draco\new_git_class>git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
nothing to commit, working tree clean
C:\Users\draco\new_git_class>git add -A
C:\Users\draco\new_git_class>echo >> my_new_file.txt
C:\Users\draco\new_git_class>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment