Command

git

16 useful snippets found.

How to stage changes

git add .

How to create and switch to a new branch

git checkout -b [branch_name]

How to list branches

git branch

How to clone a repository

git clone [url]

How to commit changes

git commit -m "[message]"

How to show changes

git diff

How to initialize a Git repository

git init

How to see the commit graph

git log --oneline --graph --all

How to merge a branch

git merge [branch]

How to pull changes from remote

git pull origin [branch]

How to push changes to remote

git push origin [branch]

How to check remote URLs

git remote -v

How to check the status

git status

How to stash changes

git stash

How to switch branches

git switch [branch]

How to change the remote repository URL

git remote set-url origin [new_url]