Some Commands of GIt and Github
yum install git | to install git in linux |
git --version or yum info git | to check git version and chech installed or not |
git config --global user.name | to configure username |
git config --global user.email | to configure email |
git init | to create local repository or project |
git add | to add file into staging area |
git add . | to add all file into staging area |
git commit -m "message" | to commit file with message in commit area |
git commit -m "message" . | to commit all files with message in commit area |
git ls-files | to check the files in commit area |
git show | last commit that we have done |
git show or git log -p | to show details of a perticular commit id |
git log --all | all the commits done so far,start to end(latest) |
git log --oneline | all the commits in short format |
1. public Repo 2. private |
benefit of github: if you want to pull from public repository then it will not ask userid and password and all other case it will ask userid and password
|
git rm state.txt | delete the file |
git checkout --states.txt | helps us to restore the file before putting into staging or conniting |
git reset HEAD states.txt | Use only when the file are in staging area |
git revert | Use only when you commited the file |
git pull | get the latest file from remote repository , check before push |
git push | push your local repository changes into remote repository |
git clone | clone a remote repository in to your local repository |
git local configuration | if we are trying to create any specific config for a project, at local level |
Branch uses : 1. code experimentation 2. apply changes on exisiting code 3. testing the code 4. debugging the code |
|
git remote -v | Check any local repository is connected with Remote Repository or not |
git branch | To List all branch (Master-Not Remote Originated,Main-Remote Originated i.e using GitClone etc) |
git branch hyderabad | Create a new branch called hyderabad |
git checkout hyderabad | Switch to hyderabad branch (create a new file and commit in hyderabad branch) |
git checkout main | switch to main branch to merge new file created in hyderabad |
git merge hyderabad | pick from hyderabad branch marge it in main branch |
git pull | get the latest file from remote repository , check before push |
git push | push your local repository changes into remote repository |
git branch -d hyderabad | to delete the hyderabad branch |
git branch -m hyderabad delhi | to rename hyderabad baranch to delhi |
git branch -m main india | you can rename main branch but not recomended |
.gitignore | if we do not want to apply any VCS, then we should update the file name in gitignore |
git diff | it will compare the data that is in CA to that of WD/WC |
git diff --staged | it will compare file/content in stage to that CA |
git config --global color.ui true git config --global color.status auto git config --global color.branch auto |
How to set the color high lighting in Git |
No Comments Yet!!