- to initialize git for a specific folder we need to go into the folder and initialize the git so it can monitor the changes in it. It initializes an empty repository
- to see that status of our initialized repository. what files we have in our folder. which branch we are on, what is the status of untracked files , what we need to commit etc. give the information of current state of git repository
- "git add filename" adds a specific file to a stage. A stage is a step between tracked and untracked files. After we initialize a folder using git init git detects if any files are inside the directory. if we delete them before adding them git can't restore them. but if we add them and commit them then we can restore those files. "git add filename" adds a single file "git add ." add all the files inside our directory which can be risky if we want some files not to be tracked. git add actually adds the untracked files to a stage and once we commit we can track them properly. only adding them makes file recognizeable but not trackable. after commiting the files becomes trackeable.
- to commit any changes to our repo. if we have made some changes to our files and we have added them we can use commit to permanently monitor those changes.
- to push code to a master branch. by default a master branch is initialized and created but we can create other branches tool.
- to create a new branch with a specific branchname. it means to checkout from main/master branch and create a new branch.
- to return to master branch from any other branch.
- to switch from one branch to another
- to see which files are in a current branch
- It list all the branches in our repo and also shows on which branch we are in with a * before our branch.
- to remove/delete a branch with specific branch name on our local repo.
- after deleting a branch from local repo we can reflect the changes in our remote server(github) by using above commands. this will delete the branch on github too.
- merges the current current content in branch_name to the current branch you are in .
- shows the difference between past content in the file and current file if you have removed any lines or add new ones.
- Shows the difference in files between current branch you are in and the branch you mentioned
- to restore a deleted file
- to remove file after stagging using git add..
- to see the logs of git. what commits you made what changes you have done so on.
- to revert back to a previous commit. hashcode can be obtained by using git log command which will show commits with a code.
- to pull any file created in github and we want it onto our local system
- to copy a repository created in gihub and we want to clone it into our local system git clone is used
- to connect our local repo to remote (Github, Gitlaab , Bitbucket)
- to show any remote repositories connect to our local repo
- to push code to a new branch
- to configure git globally
- to configure git globally
- to see the list of globally configured git users on this computer
- to know information about any commands here only config is used