[Document] ### [Title]: Comprehensive GIT Beginners Guide from Scratch - Part 2 ### ### [Published]: 14/09/2022 ### ### [Description]: ### ### This is a complete walkthrough from scratch of a local ### git configuration and github remote repository utilization ### ---------------------------------------------------- ## ## Table of contents 1. ### ---------------------------------------------------- ### ## Additional usefull git commands ## Display status and changes git status -s git diff ## Display all branches and files: ## [Note]: The first line will show the unique hash for the comit git log -p git log --all --graph ## Example Output: * commit 47619c61999b545c3eb467706ab2523d94669310 | Author: Username | Date: Wed Sep 14 14:15:56 2022 +0200 | | Minor design change | ## Show details of the latest commit git show ## Display a specific commit git show ## --- ## ## Working with Repository Branches: ## List current branch git branch ## Rename your current (repository) branch: branch -M main ## Create a new branch 1. git checkout -b new-branch 2. git branch new-branch ## Change branch git checkout new-branch ## Delete branch git branch -d new-branch ## --- ## ## Git merge ## [Description]: ## ## A 'merge' is always a left hand action based on your _current_ branch ## Example: ## The repository consists of 2 branches named 'main' and 'feature-1' ## We are going to merge the changes made in branch 'feature-1' to the 'main' branch. ## First we make sure that we are in the 'main' branch: git checkout main git merge feature-1 git push (optional) ## --- ## ## [TODO] ## Git rebase ## [Description]: git rebase --abort ## --- ## ## Merge conflicts git rebase --abort git merge --abort ## [/TODO] ## -------------------------------------------------------------- ## ## Git global and local customizations: ## [TODO] ## Examples: ## URL: https://gist.github.com/digitaljhelms/3866785 ## [/TODO] ## Git [core] ## Set default carriage return / line feed mode for your operating system: ## Linux: git config core.autocrlf input ## Windows: git config core.autocrlf true ## --- ## ## Git [aliases] ## [Note]: In case of 'access denied' errors, make sure that ## you dont have 'unaccessible' directories in your '$PATH' ## Examples: ## Adding alias 'origin' to your local configuration file '.git/config': git config alias.origin "remote -v" ## CColoring the 'git log --graph' output git config alias.log2 "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --" ## --- ## [/Document]