Skip to content

Instantly share code, notes, and snippets.

@pixelspencil
Last active March 23, 2021 00:03
Show Gist options
  • Save pixelspencil/1dceb42b0abe15cb64487fd302c01c9a to your computer and use it in GitHub Desktop.
Save pixelspencil/1dceb42b0abe15cb64487fd302c01c9a to your computer and use it in GitHub Desktop.
GIT 101

GIT 101


git clone

git clone <https://name-of-the-repository-link>

git branch

git branch <branch-name>

push the new branch into the remote repository:

git push -u <remote> <branch-name>

viewing branches:

git branch or git branch --list

deleting a branch:

git branch -d <branch-name>

git checkout

git checkout <name-of-your-branch>

shortcut command allows to create and switch

git checkout -b <name-of-your-branch>

git status

git status

git log

git log

git log --oneline

git add

git add <file>

Add everything at once:

git add -A

git commit

git commit -m "commit message"

git push

git push <remote> <branch-name>

if is newly created, then you also need to upload the branch with the following command:

git push --set-upstream <remote> <name-of-your-branch> OR git push -u origin <branch_name>

git pull

git pull <remote>

git revert

git revert XXXXXXX

git merge

git checkout dev

git fetch

git merge <branch-name>


Useful links

10 important git commands that every developer should know

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment