-
Notifications
You must be signed in to change notification settings - Fork 0
Git Commands
atakemin edited this page Feb 20, 2025
·
1 revision
Git is a powerful version control system that helps developers track changes in their projects. Below is a summary of essential Git commands categorized by their purpose.
Command | Description |
---|---|
git config --global user.name "Your Name" |
Sets the global username for Git commits |
git config --global user.email "[email protected]" |
Sets the global email for Git commits |
git config --list |
Displays the current Git configuration |
Command | Description |
---|---|
git init |
Initializes a new Git repository |
git clone <repo-url> |
Clones an existing repository |
Command | Description |
---|---|
git status |
Shows the status of changes in the working directory |
git add <file> |
Stages a file for commit |
git add . |
Stages all changes |
git commit -m "Your message" |
Commits staged changes with a message |
git commit --amend -m "New message" |
Amends the last commit message |
Command | Description |
---|---|
git branch |
Lists all branches |
git branch <branch-name> |
Creates a new branch |
git checkout <branch-name> |
Switches to a different branch |
git checkout -b <branch-name> |
Creates and switches to a new branch |
git merge <branch-name> |
Merges a branch into the current branch |
git rebase <branch-name> |
Reapplies commits on top of another base branch |
Command | Description |
---|---|
git remote -v |
Lists remote repositories |
git remote add <name> <url> |
Adds a remote repository |
git push <remote> <branch> |
Pushes local changes to a remote repository |
git pull <remote> <branch> |
Fetches and merges changes from a remote repository |
git fetch <remote> |
Fetches changes from a remote repository without merging |
Command | Description |
---|---|
git reset <file> |
Unstages a file |
git reset --hard <commit> |
Resets to a previous commit and discards all changes |
git revert <commit> |
Creates a new commit that undoes a previous commit |
git checkout -- <file> |
Discards changes in a working directory file |
Command | Description |
---|---|
git log |
Shows commit history |
git log --oneline |
Shows a concise commit history |
git diff |
Shows changes between commits, branches, or working states |
Command | Description |
---|---|
git stash |
Saves uncommitted changes for later |
git stash pop |
Applies the last stashed changes and removes them from stash |
git stash list |
Lists all stashed changes |
Command | Description |
---|---|
git tag |
Lists all tags |
git tag -a v1.0 -m "Version 1.0" |
Creates an annotated tag |
git push origin --tags |
Pushes tags to a remote repository |
- Use
git help <command>
to get detailed documentation on a specific command. - Use
git alias
to create shortcuts for frequently used commands.
This cheat sheet provides an overview of fundamental Git commands. For more details, refer to the official Git documentation.
- Ahmet's Bio
- Baran's Bio
- Barathan's Bio
- Berke's Bio
- Caglar's Bio
- Ege's Bio
- Mehmet Emin's Bio
- Nilsu's Bio
- Selman's Bio
- Taha's Bio
- Ömer's Bio
- Meeting #1
- Meeting #2
- Meeting #3
- Meeting #4 (with Assistant)
- Huddle #1
- Meeting #5
- Meeting #6
- Meeting #7
- Meeting #8
- Meeting #9
- Project Plan
- Requirements
- Elicitation Questions & Answers
- Scenario #1
- Scenario #2
- Scenario #3
- Scenario #4
- Scenario #5
- Scenario #6
- Scenario #7
- Scenario #8
- Scenario #9
- Scenario #10
- Scenario #11
- Scenario #12
- Scenario #13
- Scenario #14
- User Manual for Frontend-Web
- System Manual for Frontend-Web
- Research Documentation for Frontend-Web
- Testing Manual for Frontend-Web