This post is a quick reference to the basic git commands and to use GitHub.
- Get version: git --version
Starting the process
- git init (Creating a git repository locally in the project folder)
- git status (displays the state of the working directory and the staging area)
Configuring global username/email
- git config --global user.name '<your name>'
- git config --global user email '<your email>'
Project management
- git add <filename> (adds a change in the working directory to the staging area)
- git add *.<filetype> (adds changes in the files with specified filetype)
- git add . (add all changes in the working directory to the staging area)
- git rm --cached <filename> (remove a file from git repository)
- git commit -m "<your message>" (save changes in the local repository)
- git branch <branch name> (create a branch)
- git checkout <branch name> (switch to specified branch)
- git merge <branch name> (merge specified branch)
Remote project management
- git remote add <remote name> <https://...> (adding remote repository)
- git remote (status of remote repositories)
- git push -u <remote name> <local branch> (push commits in the <local branch> to remote repo.)
If you need a video tutorial please refer to: