0% found this document useful (0 votes)
40 views

Git Notes Practice Commands

The document discusses the basics of Git and some common commands used for version control. It defines local and remote repositories, the staging area, and working directory. It then lists and explains 9 important Git commands: 1) configuring user information, 2) initializing a local repository, 3) checking the status, 4) adding files to the staging area, 5) committing changes, 6) viewing commit history, 7) checking the current branch, 8) pushing code to a remote branch, and 9) cloning a project from GitHub. Finally, it discusses branching workflows and how to create a new branch.

Uploaded by

nsathish2622
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views

Git Notes Practice Commands

The document discusses the basics of Git and some common commands used for version control. It defines local and remote repositories, the staging area, and working directory. It then lists and explains 9 important Git commands: 1) configuring user information, 2) initializing a local repository, 3) checking the status, 4) adding files to the staging area, 5) committing changes, 6) viewing commit history, 7) checking the current branch, 8) pushing code to a remote branch, and 9) cloning a project from GitHub. Finally, it discusses branching workflows and how to create a new branch.

Uploaded by

nsathish2622
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

Githud : it is an open source and any one can use it free of cost.

Remote Repository: it is simply called as repo. it is project folder/package.

Local Repository: it is project in the local machine like our lpatop/desktop.

Staging Area:

Working Directory:

-------------------------------------------------------------------
Some imp commands:

1. to set user name and email

git config --global user.name "ImDwivedi1"


git config --global user.email "[email protected]"

---------------------------------------------------------------------------

2. This command is used to create a local repository.

git init Demo

--------------------------------------------------------

3. The status command is used to display the state of the working directory and the
staging area.

git status

----------------------------------------------------------------

4. This command is used to add one or more files to staging (Index) area.

-> To add one file ( git add Filename )

-> To add more than one file ( git add* )

----------------------------------------------------------------

5. Commit command is used in two scenarios. They are as follows.

git commit -m " Commit Message"

git commit -a -m "hi i commited"

------------------------------------------------------------

6. to see the number of commits

git log

-------------------------------------------------------

7. to check the current branch..it will show on which branch u r...like


master/main/develop

git branch
-----------------------------------------------------------

8. to push the code into branch

git push -u origin main

---------------------------------------------------

9. to clone the project from github

git clone URL

-------------------------------------------------

BRANCH:
----------

-> will create one our own branch ..then will do commit and push to that branch
from there will rise PR(pull request) to merge into master/main branch.

how to create branch:


--------------

git checkout -b "demo"

You might also like