This is my first demo repository .
author - Ritam acharya.
Step1 :
Install git for MAC or Windows or Linux
Step2 :
Install git bash
Use GitBash to run these commands
Set the configure file :
git config --global user.email "email"
git config --global user.name "name"
To set vs code as a default code editor
git config --global core.editor "code --wait"
To check the list of the configuraton in config file
git config --list
To check the version of git
git --version
To check git status
git status
To see all the history of your repository
git log --oneline
To check the branches available
git branch
To create a new branch
git branch <branch-name>
To switch your current branch into an existing branch
git switch <branch-name>
or
git checkout <branch-name>
To switch your current branch into a branch if it exist else create one and then switch
git switch -c <branch-name>
To merge a branch
git merge <branch-name>
make sure you are in the branch in which you wants to marge
To rename a branch
git branch -m <old-name> <new-name>
To delete an existing branch
git branch -d <branch-name>
To compare between branches or commit
git diff <commit-hash1>..<commit-hash2>
git diff <branch-name1> <branch-name2>
To temporarily store staged changes while switching your branch
git stash
To give name to tour stash
git stash save "name"
To see the list of stash
git stash list
To get back the last stash
git stash apply
To apply the specific stash
git stash apply stash@{0}
To apply the stash and delete from temporary
git stash pop
To remove the stash only
git drop
To clear stash
git stash clear
To create a new tag with the specific name
git tag <tag-name>
To create an annoted tag
git tag -a <tag-name> -m "message"
To list all the tags
git tag
To add tag to a specific comment
git tag <tag-name> <commit-hash>
To delete a tag
git tag -d
To push tag to a remote repository
git push origin <tag-name>
To delete tag on a remote repository
git push origin :<tag-name>
To rebase branch
git rebase main
makesure you are not on main branch
To get entire history
git reflog
To get specific commit details
git reflog <commit-hash>
To move back to your code even after commiting something new
git reset --hard <commithash>
To see your remote url of your repository
git remote -v
To initialize a git repository and upload it on github
git init
git add <file-name>...
git commit -m "type your commit message here"
git push -u origin main