Git Commands to use in CLI:

Local Repository:

1. Git init: to initialize a git repository

2. Git add: Adds files to the staging area.

3. Git commit: Adds files to the local repository.

4. Git status: This shows the list of untracked files.

5. git log: displays the log of commits

6 git diff: displays the change between committed and changes done to file.

7: Git Checkout: used to roll back changes to committed files.

For remote repository:

After creating the local repository:

1. git remote add origin ("URL of repository"): used to define the location of the remote repo.

2. git push -u origin master: used to push the files in the local repository to the remote repository.

Additional:

touch  .gitignore: creates a hidden file of git ignores. Git ignore is used to ignore the files from the final commit.  

git clone (filename): is used to clone any open source repository.

Branching and merging:

git branch (filename): creates a new branch.

git branch: displays the number of branches of the repository.

git checkout (filename): used to navigate between branches.

git merge (branch name): Merges the specified branch to the master branch.







Comments

Popular posts from this blog

To read data from database using mongo driver

To do list (without styling and css)

Template, layout and scope