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

Git Commands

The document provides instructions for basic Git commands including initializing a Git repository, tracking files, staging changes, and committing files to the local repository. It demonstrates how to create a directory and files, add files to staging, commit files to the local repo, view commit logs and push changes to a central repo. It also shows how to configure user information for the repo and lists the different states files can be in.

Uploaded by

rajesh kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views

Git Commands

The document provides instructions for basic Git commands including initializing a Git repository, tracking files, staging changes, and committing files to the local repository. It demonstrates how to create a directory and files, add files to staging, commit files to the local repo, view commit logs and push changes to a central repo. It also shows how to configure user information for the repo and lists the different states files can be in.

Uploaded by

rajesh kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

1)mkdir rajesh (creating new directory/new folder) *here "rajesh" is a direcory

name.

2)ls (shown directories and files)

3)touch rajesh1 (creating 'new files' in direcory) *here "rajesh1" is a file name.

4)cat > rajesh1 (here we can 'type' any information). ex: rajesh is a good boy.

5)cat rajesh1 (here we can 'see' informaton in the file) ex: rajesh is a good
boy(display).

6)git status (it shows status of 'repository')

7)git init (.'git'--means hidden directory/hidden file).

8)ls -a (hidden directories shown).

9)git config--global user.name "rajesh" ex: RAJESH.

9)git config--global user.email "[email protected]". ex:[email protected].

10)git config --list ex:list of every configuration.

exercise-2(a)
-------------

11)git status (display shown Both 'workspace files' and 'staging/index files').

12)workspace indetify (Red colour/Untracked files) it'll display.

13)stagig/index identify (Green colour/changes to be commited) it'll display.

14)'git add file name' (moving workspace to staging).

15)git commit -m label file (moving local repo to central repo).

16)git log and git commit (display local repo files and commit id's create)
ex:cid1,cid2...etc.

17)git push (moving local repo to central repo).

18)git show cid (here 'cid' means commit id)(it shows how many files in commit).

cid =copy and paste in cid place.

19)git add file1 file2 file3....etc (multiple files share ws to index)


touch file1 file2 file3 ....etc

git add *(or)


git add . (or)
git add -a.

11)git commit -m "label" file (only modify files 'WORKSPACE to LOCAL REPOSITORY'
MOVE FROM.
12)git reset HEAD file ('STAGING TO WORKSPACE').

13)git reset --soft cid (LOCAL REPOSITORY TO STAGING)

You might also like