Cheatography
https://cheatography.com
Git : Configure
git config --global user.email "youremail@example.com" |
sets email address respectively to be used with your commits. |
git config --global user.name "FirstName LastName" |
sets the author name. |
git config --list |
command to list all the settings Git can find at that point. |
git config --global color.ui true |
Git automatically colors of its output. |
Git : commit to repository
git commit -m "Add three files" |
command records or snapshots the file permanently in the version history. |
git commit --amend -m <enter your message> |
command allows you to change the commit message. |
Git : branching
git branch |
command lists all the local branches in the current repository. |
git branch <branch-name> |
command creates a new branch. |
git checkout <branch-name> |
command is used to switch from one branch to another. |
git merge <branch-name> |
command merges the specified branch’s history into the current branch. |
git checkout -b <branch-name> |
command creates a new branch and also switches to it. |
|
|
Git : Initiating a repository
git init |
command is used to start a new repository. |
git status |
command lists all the files that have to be committed. |
Git : Pulling & pushing from and to repositories
git remote add origin <link-to-repo> |
command is used to connect your local repository to the remote server. |
git push -u origin master |
command sends the committed changes of main branch to your remote repository. |
git clone <link-to-clone-repo> |
command is used to obtain a repository from an existing URL. |
git pull |
command fetches and merges changes on the remote server to your working directory. |
Git : Staging
git add <file-name> |
command adds a file to the staging area. |
git add <file-name> <second-file-name> <third-file-name> |
command adds one or more files to the staging area. |
git add . |
command adds all files under the current directory to the staging area. |
git add --all |
command finds all new and updated files everywhere throughout the project and add them to the staging area. |
git add -A |
Same as --all |
git reset <file-name> |
command unstages the file, but it preserves the file contents |
|
Created By
Metadata
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets
More Cheat Sheets by rishabkumar7