19/05/2024
๐๐จ๐ฉ 1๏ธโฃ5๏ธโฃ ๐๐ฌ๐ฌ๐๐ง๐ญ๐ข๐๐ฅ ๐๐ข๐ญ ๐๐จ๐ฆ๐ฆ๐๐ง๐๐ฌ ๐๐จ๐ซ ๐๐ฏ๐๐ซ๐ฒ ๐๐๐ฏ๐๐ฅ๐จ๐ฉ๐๐ซ
1๏ธโฃ ๐ ๐ข๐ญ ๐ข๐ง๐ข๐ญ
- Initializes a new Git repository in the current directory
2๏ธโฃ ๐ ๐ข๐ญ ๐๐ฅ๐จ๐ง๐
- Creates a local copy of a remote repository
3๏ธโฃ ๐ ๐ข๐ญ ๐๐๐
- Stages changes in the working directory for the next commit
- Example: git add file.txt (to stage a single file) or git add . (to stage all changes)
4๏ธโฃ ๐ ๐ข๐ญ ๐๐จ๐ฆ๐ฆ๐ข๐ญ
- Records changes to the local repository with a descriptive message.
- Example: git commit -m "Fixed bug in login functionality"
5๏ธโฃ ๐ ๐ข๐ญ ๐ฌ๐ญ๐๐ญ๐ฎ๐ฌ
- Shows the current state of the working directory and staging area.
6๏ธโฃ ๐ ๐ข๐ญ ๐๐ซ๐๐ง๐๐ก
- Lists, creates, or deletes branches.
- Example: git branch (to list branches), git branch new-feature (to create a new branch), git branch -d new-feature (to delete a branch)
7๏ธโฃ ๐ ๐ข๐ญ ๐๐ก๐๐๐ค๐จ๐ฎ๐ญ
- Switches between branches or restores files from a different commit
- Example: git checkout main (to switch to the "main" branch), git checkout -- file.txt (to discard changes in a file)
8๏ธโฃ ๐ ๐ข๐ญ ๐ฆ๐๐ซ๐ ๐
- Integrates changes from one branch into another
- Example: git merge new-feature (to merge the "new-feature" branch into the current branch)
9๏ธโฃ ๐ ๐ข๐ญ ๐ฉ๐ฎ๐ฌ๐ก
- Uploads local commits to a remote repository
- Example: git push origin main (to push commits from the local "main" branch to the remote "origin" repository)
๐ ๐ ๐ข๐ญ ๐ฉ๐ฎ๐ฅ๐ฅ
- Uploads local commits to a remote repository.
- Example: git push origin main (to push commits from the local "main" branch to the remote "origin" repository)
1๏ธโฃ1๏ธโฃ ๐ ๐ข๐ญ ๐ฅ๐จ๐
- Shows the commit history with commit messages and author information
1๏ธโฃ2๏ธโฃ ๐ ๐ข๐ญ ๐๐ข๐๐
- Shows the differences between commits, branches, or the working directory and staging area. It is invaluable for reviewing changes before committing or understanding the differences between commits or branches
- Example: git diff (to show unstaged changes), git diff --staged (to show staged changes), git diff commit1 commit2 (to compare two commits)
1๏ธโฃ3๏ธโฃ ๐ ๐ข๐ญ ๐ฌ๐ญ๐๐ฌ๐ก
- Temporarily saves changes that are not ready to be committed
- Example: git stash (to stash changes), git stash pop (to apply the stashed changes and remove them from the stash)
1๏ธโฃ4๏ธโฃ ๐ ๐ข๐ญ ๐ซ๐๐๐๐ฌ๐
- Applies commits from one branch onto another, rewriting the commit history
- Example: git rebase main (to rebase the current branch onto the "main" branch)
1๏ธโฃ5๏ธโฃ ๐ ๐ข๐ญ ๐ซ๐๐ฌ๐๐ญ
- Undoes commits or reverts the repository to a previous state
- Example: git reset --hard HEAD~1 (to discard the last commit and all changes), git reset --soft HEAD~2 (to undo the last two commits but keep changes in the working directory)