https://github.com/devgametools/github_practice
PRACTICE OF GITHUB COMMANDS
https://github.com/devgametools/github_practice
Last synced: 4 months ago
JSON representation
PRACTICE OF GITHUB COMMANDS
- Host: GitHub
- URL: https://github.com/devgametools/github_practice
- Owner: Devgametools
- License: mit
- Created: 2025-02-03T14:03:37.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2025-02-05T15:39:17.000Z (5 months ago)
- Last Synced: 2025-02-05T16:37:59.268Z (5 months ago)
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# **GIT - GITHUB**
## Local Repositories
### Basic Commands
- #### git --help
Shows the help menu.
```bash
git --help
```- #### git init
Initializes a git repository.
```bash
git init
```- #### git config
Configures git.
```bash
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
```- #### git status
Shows the status of the repository.
```bash
git status
```- #### git add
Adds a file to the staging area.
```bash
git add
git add * # Adds all files
git add . # Adds all files includind hidden files as .gitignore
```- #### git rm
Removes a file from the staging area.
```bash
git rm --cached
```- #### git commit
Commits the staged changes.
```bash
git commit -m "Commit message"
git commit -am "Commit message" # Add and commit changes
```- #### git log
Shows the commit history.
```bash
git log
git log main..origin/main # Shows the commit history between the main branch and the origin/main branch
```### Advanced Commands
- #### git branch
Creates a new branch.
```bash
git branch # Shows the current branch
git branch # Creates a new branch
git branch -D # Deletes a branch
```- #### git checkout or git switch
Switches to a branch.
```bash
git checkout
git switch
```- #### git checkout (Certain commit)
Switches to a certain commit to make changes for testing.
```bash
git checkout
git checkout -b # Creates a new branch
git checkout main # Switches to the main branch
```- #### git merge
Merges a branch into the current branch.
```bash
git merge
git merge origin/main # Merges the origin/main branch into the current branch
```- #### git rebase
Rebases a branch into another branch.
- #### git revert
Reverts a commit.
```bash
git revert
```- #### git reset
Resets the current branch to a previous commit.
```bash
git reset --soft # Soft reset
git reset --mixed # Mixed reset
git reset --hard # Hard reset
```- #### git stash
Stashes the current changes.
- #### git tag
Tags a commit.
```bash
git tag -a -m "Tag message" # Creates a tag
git tag # Creates a tag
git show # Shows the commit associated with a tag
git tag -d # Deletes a tag
```- #### git reflog
Shows the commit history.
## Remote Repositories
### Remote Basic Commands
- #### create ssh key
```bash
ssh-keygen -t rsa -b 4096 -C "[email protected]" # Creates an rsa key
ssh-keygen -t ed25519 -C "[email protected]" # Creates an ed25519 key
eval "$(ssh-agent -s)" # Evaluates the ssh key
ssh-add ~/.ssh/id_rsa # Adds the key to the ssh-agent
ssh -T [email protected] # Tests the connection
```- #### git remote
Manages remote repositories.
```bash
git remote add origin
```- #### git clone
Clones a repository.
```bash
git clone
```- #### git push
Pushes the commits to the remote repository.
```bash
git push origin
```- #### git pull
Pulls the commits from the remote repository.
```bash
git pull origin
```- ##### git fetch
Fetches the commits from the remote repository.
```bash
git fetch origin
```### Working with Branches
- #### git diff
Shows the differences between the current state and the last commit.