-
Git is an version control software which allows use to track the change and allows better collaboration
-
Git is software and Github is service which is web hosted
-
Make the atomic commits , these are the way to make sure that each commit is self contained also give order to code as message
-
.gitignorewill contain the files and folders which will ignore by github -
.gitkeepif you want to track empty folder -
Each commit in the project is stored in .git folder in the form of a commit object. A commit object contains the following information:
- Tree Object
- Parent Commit Object
- Author
- Committer
- Commit Message
-
Tree Object is a container for all the files and folders in the project. It contains the following information:
- File Mode
- File Name
- File Hash
- Parent Tree Object
-
Everything is stored as key-value pairs in the tree object. The key is the file name and the value is the file hash.
-
Blob Object is present in the tree object and contains the actual file content. This is the place where the file content is stored.
-
The HEAD is a pointer to the current branch that you are working on
git --version: Give the versiongit status: command will show you the current state of your repositorygit config --listgit init: init the git reposgit add: add files to staging areagit commit: add the check pointgit restore--staged <file>: to unstagegit commit -m <message>: add the checkout point with messagegit log: very vast use man to know moregit log --oneline: simplify the logs
git branchlist all branchgit branch <branch_name>to create the branchgit switch <branch_name>to switch to branch_namegit switch -c <new_branch>use to create branchgit branch -m <old-branch-name> <new-branch-name>rename the branchgit branch -d <branch-name>delete the branch
git show -s --pretty=raw <commit-hash>git ls-tree <tree-id>git show <blob-id>git cat-file -p <commit-id>