summaryrefslogtreecommitdiff
path: root/git-course/git-commands.txt
diff options
context:
space:
mode:
Diffstat (limited to 'git-course/git-commands.txt')
-rw-r--r--git-course/git-commands.txt92
1 files changed, 92 insertions, 0 deletions
diff --git a/git-course/git-commands.txt b/git-course/git-commands.txt
new file mode 100644
index 0000000..076bcaf
--- /dev/null
+++ b/git-course/git-commands.txt
@@ -0,0 +1,92 @@
+Please read the next git commands and try to understand what each one
+======================================================================
+
+# Install GIT
+
+apt install git # Debian GNU/Linux
+
+# Get help
+
+git help <command>
+git <command> --help
+man git-<command>
+
+# Configuration
+
+git config --global commit.gpgsign true
+git config --global core.editor "emacs"~
+git config --global core.editor "nano -w"~
+git config --global core.editor "vim"~
+git config --global user.name "Javier"
+git config --global user.email javier@taler-systems.com
+git config --list
+
+# Create or download repositories
+
+git init
+git init --bare
+git clone URL
+
+# Local commands
+
+git add file1.txt
+git add .
+git commit -m "Improvements in file1.txt"
+git commit --amend
+git status
+git log
+git log --pretty --graph all
+
+# Undoing things
+
+git checkout -- <filename> # Recover file from HEAD to the WD
+git reset --hard # good locally
+git reset --soft # good locally
+git revert commit-id # good for remote
+
+# Removing files
+
+git rm file
+git rm --cached # Removes a file from the Staging Area, but doesn't affect the Working directory
+git mv name new-name
+
+# Diff command
+
+git diff 1.txt
+git diff file1 file2
+git diff # Difference between WD and SA
+git diff --cached
+git diff id-commit-1 id-commit-2
+git diff HEAD~1 HEAD
+
+
+# Git tags
+
+git tag
+git tag --list
+git tag v1.4-lw
+git show v1.4-lw
+
+** ANOTADAS
+
+git tag -a v1.4 -m "1.4"
+git tag --list
+git tag -d 1.4 # remove tag
+git push origin tag-name # Upload to remote, tag name
+
+# Managing remote repositories
+
+git remote -v
+git remote add [shortname] [url]
+git push [remote-name] [branch-name] # Normally "origin and master"
+git remote rm <remote-name>
+
+
+# Uploading and Downloading remote information
+
+git pull
+git push
+git fetch
+
+
+