GIT
GIT
● GIT Configurations
- System
Configurations are apply for all the users who use the machine.
- Global
Configurations are apply only for a user who already login to the machine.
- Local
Configurations are apply only for the project.
- List the Global configurations
git config --global list
- Add user email, name and editing tool
git config --global --add user.email "Type Your Email"
git config --global --add user.name "Type Your preferred user name"
git config --global --add core.editor "Type Your preferred software tool to edit your code"
git config --global --add color.UI "Type true if you want to see the difference between two commitments by color it."
● Three Tree Architecture in GIT
- Initialize a git repository
git init
- Show current status of the repository(show edited files)
git status
- Add all the files into staging index from working directory(working copy)
git add .
OR
Add specified file into the staging index
git add fileName.html
- add the files into the repository
git commit :- add message in the opened file
OR
git commit -m "type your message to identify the commitment" :- add message without opening the file using the default editor
● Commands for Commitments
- Show all the commitments and the point of the head
git log
ORgit log --oneline :- show commitments with hash
- Go to previous commitments
git checkout type the preferred commitment with hash tag
● Check difference between commitments,branches,three stages
- Show the different lines between working directory and staging index.
git diff
- Show the different lines between working directory and head.
git diff HEAD
- Show the different lines between working directory and commitment.
git diff type the commitment with hash
- Show the different lines between staging index and head.
git diff --cashed HEAD
- Show the different lines between staging index and commitment
git diff --cashed Type the commitment with hash
- Show the different lines between two commitments.
git diff commit_1 commit_2
- Show the different lines between two branches.
git diff branchName1 branchName2
● GIT Branches
- List all branches
git branch
- Add new Branch.
git branch "barnchName"
- Rename Branch.
git branch -m "current name of the branch" "new name of the branch"
- Delete a branch
git branch -d "branch name"
- Shift the branch.
git checkout "branch name"
- Merge branch into master branch.
git merge "branch name"
- Create a new branch and switched to the newely created branch.
git checkout -b "branch name"
- Create a new branch from old commitment.
git checkout -b "branch name" "commitment with hash"
ORgit branch "branch name" "commitment with hash"
● GIT RESET
git reset [option] "commitment with hash"
Comments
Post a Comment