- git config --list
- to see configuaration of the git
- git config --global user.email "example@gmail.com"
- to set or change the email of the user in git
- git config --global user.name "username"
- to set or change the username in the git
- git status
- shows the status of the action conducted on the git
- git diff --staged
- shows the difference between two version of the staged files
- git add filename
- to add single file of particular filename in staging area
- git add filename1 filename2
- to add multiple files to staging area of particular name in git
- git add .
- to add all files in git
- git commit -m "message"
- to add file to local repository with a unique and distinctive message
- git commit -am "message"
- adds file to staging area and then to local repository
- git log
- shows the detail history of commit
- git log --oneline
- shows the detail history of commit command in oneline
- git checkout #number
- takes us to the version of the given hash number
- git checkout branchname
- takes us to the required branch
- git remote add origin "url of the github"
- adds the orgin or path of the github repo
- git remote remove origin
- removes the origin path of the github
- git remote -v
- git remote show origin
- shows us the origin path of the github
- git push origin main/master
- pushes all the changes to the main branch in github
- git push origin branch_name
- pushes all the change in the code to the specified branch
- git clone "url of the github account"
- clones the whole project in our computer
- git branch branch_name
- creates new branch in the git
- git branch
- shows all the branch created in the git
- git merge "branch_name"
- note to make sure to go to the main branch where we want to merge the files
- git merge --no-ff "branch_name"
- merges the file with no fastforward
- git branch --merged
- shows merged branch
- git branch --no-merged
- shows not merged branch
- git reset --head #number_of_previous_version
- used when we want to discard all the changes and restart from the previous version
- git branch -d "branch_name"
- deletes the branch but rejects if it is not merged
- git branch -D "branchname"
- deletes the branch even if it is not merged
- git pull origin main/master/branch_name
- pulls the chnages done by other to our code
- git tag -a tag_name -m "message"
- adds tags in the git which is used to check milestones while coding
- git stash
- puts all your current changes in hold and allows you ro pull new data form other branch without pushing your code
- git stash pop
- pops all your stashed files after you pull the branch
- git fetch --all
- fetch all the branch from git hub similar to git pull
-
Notifications
You must be signed in to change notification settings - Fork 0
It contains some of the mostly used and important commands we use while using git and github. This repository is created as a reference while needed to see commands to be used while using git and github
yogijagdish/Git-and-Github
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
It contains some of the mostly used and important commands we use while using git and github. This repository is created as a reference while needed to see commands to be used while using git and github
Topics
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published