Git
What is Git?
Git may be a free and open source conveyed adaptation control framework outlined to handle everything from little to exceptionally expansive ventures with speed and proficiency. Adaptation control framework could be a system that records changes to a record or set of records over time so that you simply can review particular forms afterward. Not at all like a central VCS, a conveyed VCS has both inaccessible and nearby stores. As a result, it does not require the reinforcement.
Installation
- Download Git from here
- Enter Configuration Values:
$ git config --global user.name "firstName lastName"
– your name
$ git config --global user.email "[email protected]"
– your email
- Check Your Settings:
$ git config --list
Help
$ git help -a
or
$ git help --all
– shows a list of all available commands
$ git help config
– explains how to use the Git verb, in this case,
config
$ git help -g
or
$ git help --guide
– shows a list of Git guides
New Repository
To create a New Repository:
$ git init
To clone a Remote Repository:
$ git clone /Url/
Staging Area
To add / propose changes:
$ git add /file/
To add everything:
$ git add .
To remove:
$ git reset /file/
Commit
To commit changes:
$ git diff
– shows the changes made
$ git commit -m "Detailed message explaining the nature of changes"
To push changes to remote repository:
$ git pull origin master
$ git push origin master
Workflow
Git project consists of three main sections:
- Working Directory
- Staging Area / Index
- HEAD
Three main states of files:
- Committed
- Modified
- Staged
Branches
A Git branch is a movable pointer to the commits. The default branch is called master.
To create a new branch:
$ git checkout -b newBranch
To remove a branch:
$ git branch -d newBranch
To go back to master:
$ git checkout master
To push to the remote repository:
$ git push origin /branch/
To merge a branch to current branch:
$ git merge /branch/
Logs
To see the commit that was just made:
$ git log
The message, author, email, and other additional information will be displayed.
$ git checkout -- /file/
or
$ git fetch origin
– to cancel all the commits implemented locally
Helpful <3
Thank you<3!
WOW ❤️??
Thank you<3!