-
Notifications
You must be signed in to change notification settings - Fork 1
Git
Anuj Jain edited this page Jan 12, 2021
·
4 revisions
- You modify files in your working directory.
- You stage changes you want to commit.
- You commit to create a snapshot and store in repository.
Working Directory | Staging Area | .git Repository |
---|---|---|
Create / Modify files | Staging for next commit | metadata and object database |
state: modified | state: staged | state: committed |
Git config settings are at 3 different levels:
- local
- global
- system.
$ git config --list --show-origin
git config --global user.name "John Doe"
git config --global user.email johndoe@example.com
$ git help <verb>
$ git <verb> --help
$ man git-<verb>
$ git clone https://github.com/JavaMasterClass/JavaMasterClass.github.io.git
$ git status
$ git add FILENAME
Add file patten to .gitignore
git commit -m "Commit Message"
$ git rm FILENAME
$ git log
$ git commit --amend
$ git reset HEAD FILENAME
$ git restore --staged FILENAME
$ git checkout -- FILENAME
alternative command
$ git restore FILENAME
git remote -v
# Get data from your remote projects
$ git fetch <remote>
# fetch data and automatically tries to merge
$ git pull
# git push <remote> <branch>
$ git push origin master
$ git remote show origin