Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| linux:command-collection:git [2025/06/01 18:35] – [Pushing changes to GitHub] Zyzonix | linux:command-collection:git [2026/06/02 08:38] (current) – removed Zyzonix | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ===== git (GitHub CLI) ===== | ||
| - | Packages: | ||
| - | <code bash> | ||
| - | |||
| - | ==== Configuring gh and git ==== | ||
| - | Login via (just follow the prompts) | ||
| - | <code bash>gh auth login</ | ||
| - | |||
| - | Config username and email: | ||
| - | -> remove '' | ||
| - | <code bash>git config --global user.email "< | ||
| - | <code bash>git config --global user.name "< | ||
| - | Replace '' | ||
| - | |||
| - | ==== Initialize directory for git ==== | ||
| - | Change to the highest directory of your project, then intialize repository: | ||
| - | <code bash>git init</ | ||
| - | |||
| - | Add the remote: | ||
| - | <code bash>git remote add origin '< | ||
| - | In case of GitHub ''< | ||
| - | |||
| - | ==== Pushing changes to GitHub ==== | ||
| - | Add files to commit: | ||
| - | <code bash>git add / | ||
| - | |||
| - | View status of changes: | ||
| - | <code bash>git status</ | ||
| - | |||
| - | Before starting to edit, sync external changes*****: | ||
| - | <code bash>git fetch < | ||
| - | <code bash>git pull origin < | ||
| - | |||
| - | Create commit: | ||
| - | <code bash>git commit -m < | ||
| - | |||
| - | Push changes*****: | ||
| - | <code bash>git push origin < | ||
| - | |||
| - | *****Replace '' | ||
| - | |||
| - | Reset to previous commit: | ||
| - | <code bash>git reset --hard < | ||
| - | To then push changes/ | ||
| - | <code bash>git push --force</ | ||
| - | |||
| - | ==== git merge and git rebase ===== | ||
| - | **Merge:** | ||
| - | <code bash>git merge</ | ||
| - | |||
| - | **Rebase:** | ||
| - | <code bash>git rebase</ | ||
| - | |||
| - | **Differences: | ||
| - | |||
| - | {{linux: | ||
| - | |||
| - | //Sourced from: [[https:// | ||