diff options
author | Javier Sepulveda <javier.sepulveda@uv.es> | 2024-02-21 09:20:35 +0100 |
---|---|---|
committer | Javier Sepulveda <javier.sepulveda@uv.es> | 2024-02-21 09:20:35 +0100 |
commit | d0f8d40bd6d615649254e92b555192658861ca83 (patch) | |
tree | 6b28b3a7a6544e39b29e437a28eefbe51150d1db | |
parent | 119d133fc4701905d93372865f9be9ad518ccb86 (diff) | |
download | training-d0f8d40bd6d615649254e92b555192658861ca83.tar.gz training-d0f8d40bd6d615649254e92b555192658861ca83.tar.bz2 training-d0f8d40bd6d615649254e92b555192658861ca83.zip |
-rw-r--r-- | git-course/git-commands.txt | 92 | ||||
-rw-r--r-- | git-course/git-test-questions.txt | 50 |
2 files changed, 142 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 + + + diff --git a/git-course/git-test-questions.txt b/git-course/git-test-questions.txt new file mode 100644 index 0000000..dcdb5eb --- /dev/null +++ b/git-course/git-test-questions.txt @@ -0,0 +1,50 @@ + +Please read the next set of questions and try to answer them. You +will find the answers in the file git-test-answers.txt. + +Git test questions +================== + +- Who wrote and invented the GIT version control program ? + +- With which command, you can configure your email name and email address with GIT? + +- When working with GIT, is it a good policy to use the "rm" or the "mv" terminal commands ? + +- What is the purpose of the HEAD pointer in GIT? + +- With which command can you copy a file from your working directory, +to the Staging Area (Also known as Index) ? + +- If you want to have write access to a remote repository, which protocol would you use ? + +- How (locally) you can remove a file from the Staging Area? + +- How (locally), I can recover the status of a file from the Staging Area, and put it +back into my Working Directory? + +- Which command you would use, if you want to remove completely a local +commit without leaving any trace on your local commit list, and at the +same time putting your working directory back in the previous commit status? + +- When doing a commit and using the "-m" parameter, what the letter "m" stands for? + +- If you forget to add certain changes or even a new file, in the last commite you have commited. +With which command would you amend this? + +- The "git clone" command, apart from downloading files from the remote server to your local computer, +and also creating the hidden .git folder within it. What else the git clone command does? + +- With which command, you can check if you still have any changed files pending to add from your working directory +to the staging area? + +- With which command, you can --list complete and local commit list? + +- How I can retrieve the remote repository commit list, and downloading the new files and changed ones, +into my working directory ? + +- With which command you would be able to see very easily the difference between 2 commits? + + + + |