git init
: initializes the directory
git clone /path/to/repository
: clones the repositroy to the current local directory
git add [filename]
: adds [filename]
to the Git staging area
git add *
: adds all the files in the current directory to the Git staging area
git commit -m "message"
: commits with "message"
git push origin [branch name]
: pushes commits to remote repository with given [branch name]
git status
: shows the current state of the working directory
git remote add origin [remote url]
: add remote repo url [remote url]
git show-ref
: list all the references
git branch -m [old branch name] [new branch name]
: rename/move the branch [old branch name]
to [new branch name]
git branch -M [branch name]
: rename the current branch to [branch name]
git pull origin [branch name]
: update local repository from remote