//create .git file
$ git init
//clones the repo from someware with the hep of a url
$ git clone <your URL>
//specifies the status of the commit
$ git status
//to log the details of the commit
$ git log
//to log the details of the commit in oneline
$ git log --oneline
//to log the details of the commit with the changes it had made in that commit.
/we can see what files were modified and how many lines of code were added or removed
$ git log --stat
//can be used to display the actual changes made to a file.
$ git log -p/$ git log -patch
//we can also combine the both stat and patch by using
$ git log --stat -p / $ git log -p --stat
//git add to add all the files from working directory to staging index.
$ git add .
// to specifically add a file to the staging index.
$ git add index.html
//commiting the staging index files with a commit name
The git commit command takes files from the Staging Index and saves them in the repository.
$ git commit -m "Initial commit"
// to push the code grom staging index to repo
$ git push
//The command we'll be using to interact with the repository's tags is the git tag command
$ git tag -a v1.0 (after d it is tag name) ($ git tag - to verify weather the tag is given or not).
// to check the tag in the log command
git log --decorate (from git version 2.13 $ git log and $ git log --decorate boht are same)
// to delete a miss spelled tag .
$ git tag -d v1.0(after d it is tag name)
// if you wanted to tag a commit that occurred farther back in the repo's history
(specift the commit sha key at the end of the tag name)
$ git tag -a v1.0 a87984
// to list all branches
$ git branch
// to create a new "footer-fix" branch
$ git branch footer-fix
// to delete the "footer-fix" branch
$ git branch -d footer-fix
//to force delete the "footer-fix" branch
$ git branch -D footer-fix
//see all branches at ones
$ git log --oneline --decorate --graph --all
//create a branch from any where we need and move to that branch
$ git checkout -b footer master
//use this command to undo the merge.
git reset --hard HEAD^
//Fast-forward merge – the branch being merged in must be ahead of the checked out branch. The checked out branch's pointer will just be moved forward to point to the same commit as the other branch.
//the regular type of merge
//two divergent branches are combined
//a merge commit is created
// The git merge command is used to combine Git branches:
$ git merge <name-of-branch-to-merge-in>
//Alternatively, git commit --amend will let you include files (or changes to files) you might've forgotten to include
$ git commit --amend
//To recap, the git revert command is used to reverse a previously made commit:
$ git revert <SHA-of-commit-to-revert>
//To alleviate the stress a bit, Git does keep track of everything for about 30 days before it completely
erases anything. To access this content, you'll need to use the git reflog command. Check out these links
for more info: