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 [2023/07/30 12:11] – removed - external edit (Unknown date) 127.0.0.1 | linux:command-collection:git [2025/06/01 18:35] (current) – [Pushing changes to GitHub] 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:// | ||