Packages:

sudo apt install gh 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 "<email-address>"
git config --global user.name "<github-username>"

Replace email-address with your GitHub email and github-username with your username.

Change to the highest directory of your project, then intialize repository:

git init

Add the remote:

git remote add origin '<url>'

In case of GitHub <url> for example can be https://github.com/<username>/<repository>/.

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 <remote-repo>
git pull origin <branch>

Create commit:

git commit -m <message>

Push changes*:

git push origin <branch>

*Replace branch with the concerning branch, e.g. main.

Merge:

git merge

Rebase:

git rebase

Differences:

Sourced from: stackoverflow.com - git merge & git rebase

  • linux/command-collection/git.txt
  • Last modified: 2024/03/03 00:05
  • by Zyzonix