Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
linux:command-collection:git [2024/03/03 00:05] – [Pushing changes to GitHub] Zyzonixlinux:command-collection:git [2026/06/02 08:38] (current) – removed Zyzonix
Line 1: Line 1:
-===== git (GitHub CLI) ===== 
  
-Packages: 
-<code bash>sudo apt install gh git</code> 
- 
-==== Configuring gh and git ==== 
-Login via (just follow the prompts) 
-<code bash>gh auth login</code> 
- 
-Config username and email: 
--> remove ''--global'' option to just configure the login for one specific repository/directory 
-<code bash>git config --global user.email "<email-address>"</code> 
-<code bash>git config --global user.name "<github-username>"</code> 
-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: 
-<code bash>git init</code> 
- 
-Add the remote: 
-<code bash>git remote add origin '<url>'</code> 
-In case of GitHub ''<url>'' for example can be ''https://github.com/<username>/<repository>/'' 
- 
-==== Pushing changes to GitHub ==== 
-Add files to commit: 
-<code bash>git add /path/to/file(s)</code> 
- 
-View status of changes: 
-<code bash>git status</code> 
- 
-Before starting to edit, sync external changes*****: 
-<code bash>git fetch <remote-repo></code> 
-<code bash>git pull origin <branch></code> 
- 
-Create commit: 
-<code bash>git commit -m <message></code> 
- 
-Push changes*****: 
-<code bash>git push origin <branch></code> 
- 
-*****Replace ''branch'' with the concerning branch, e.g. ''main''. 
- 
-==== git merge and git rebase ===== 
-**Merge:** 
-<code bash>git merge</code> 
- 
-**Rebase:** 
-<code bash>git rebase</code> 
- 
-**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]]// 
  • linux/command-collection/git.1709420730.txt.gz
  • Last modified: 2024/03/03 00:05
  • by Zyzonix