git config –-global user.name “Your Name”
To set the email with the username
git config -–global user.email “Github Email”
To list all the usernames with their email
Creation of a Git Repository
To initiate the git repository
To know the status of the modifications done
Staging and Commiting Changes in a Git Repository
To add the file or folder for staging
git add filename
git add foldername
To add multiple files or folders for staging at once
git add filename foldername foldername
To add all files and folders to staging
To unstage the file from the staging
git rm –cached filename
git restore --staged filename
git commit -m “Commit Message”
To log all the detailed history of commits
To log history of commits in short brief (single line)
To view the changes made in the files
To go back to the previous commit
To revert back to the previous commit from the present commit
To remove all the commits and return to the very initial commit
To forcefully remove all commits without any prompts and history
To check/know the present branch
To take to the desired branch
To move out from the present branch to the targeted branch
To delete the selected branch forcefully (-d is used when it is not merged)
NOTE: First be at another branch apart from targeted branch during deletion
To delete the selected branch forcefully (-D is used when it is merged)
NOTE: First be at another branch apart from targeted branch during deletion
To create new branch
NOTE: It does two things at once, first creates the new branch and shifts on it
git checkout -b newbranchname
To merge the branch with the master
NOTE: Before merge any branch, we should commit all the changes and then move to the master node
Git Remote Repository Setup
To show all the remote git repositories
To show all the remote git repositories with the link
NOTE: v
stands for verbose
To pdd the remote URL and push on it
git push remote add origin gitrepourl
Switching remote URL's and push on it
Check current URL git remote -v
Change your remote's URL from HTTPS to SSH by git remote set-url origin gitRepoURL
Verify that the remote URL has changed git remote -v
To push local repository to the remote repository online at the branch master of remote
To push forcefully local repository to remote repository online at the branch of master of remote
git push origin master --force
To delete the remote repository mentioned as arguement (remote name) and its URL from its memory
To push instantly (when origin is already set)
Remote to Local Repository Setup
To clone the remote repository to the local machine
To update the remote changes into the local repository