15 Most Common github commands Flashcards
git add [file]:
Meaning: Adds changes in the file to the staging area.
Example: git add README.md
git branch [branch-name]:
Meaning: Creates a new branch.
Example: git branch feature-x
git checkout [branch-name]:
Meaning: Switches to a different branch.
Example: git checkout feature-x
git clone [repository]:
Meaning: Copies a repository from remote to local.
Example: git clone https://github.com/user/repo.git
git commit -m “[message]”:
Meaning: Commits the changes and adds a message describing what was done.
Example: git commit -m “Updated README”
git init:
Meaning: Initializes a new Git repository.
Example: git init
git log:
Meaning: Shows the commit history.
Example: git log
git merge [branch-name]:
Meaning: Merges changes from one branch to another.
Example: git merge feature-x
git pull:
Meaning: Pulls updates from a remote repository.
Example: git pull origin master
git push:
Meaning: Pushes your committed changes to a remote repository.
Example: git push origin master
git remote add [alias] [url]:
Meaning: Adds a new remote repository.
Example: git remote add origin https://github.com/user/repo.git
git revert [commit-hash]:
Meaning: Undoes changes from a particular commit.
Example: git revert abc123
git stash pop:
Meaning: Restores the changes you’ve stashed away.
Example: git stash pop
git stash:
Meaning: Temporarily stores changes that you haven’t committed yet.
Example: git stash
git status:
Meaning: Checks the status of your changes.
Example: git status