===== git (GitHub CLI) =====
Packages:
sudo apt install gh git
==== Configuring gh and git ====
Login via (just follow the prompts)
gh auth login
Config username and email:
-> remove ''--global'' option to just configure the login for one specific repository/directory
git config --global user.email ""
git config --global user.name ""
Replace ''email-address'' with your GitHub email and ''github-username'' with your username.
==== Initialize directory for git ====
Change to the highest directory of your project, then intialize repository:
git init
Add the remote:
git remote add origin ''
In case of GitHub '''' for example can be ''https://github.com///''.
==== Pushing changes to GitHub ====
Add files to commit:
git add /path/to/file(s)
View status of changes:
git status
Before starting to edit, sync external changes*****:
git fetch
git pull origin
Create commit:
git commit -m
Push changes*****:
git push origin
*****Replace ''branch'' with the concerning branch, e.g. ''main''.
==== git merge and git rebase =====
**Merge:**
git merge
**Rebase:**
git rebase
**Differences:**
{{linux:command-collection:git_rebase_merge.png?600|}}
//Sourced from: [[https://stackoverflow.com/questions/16666089/whats-the-difference-between-Git-merge-and-git-rebase|stackoverflow.com - git merge & git rebase]]//