0% found this document useful (0 votes)
3 views1 page

Git Commands

Uploaded by

chmuzammil022
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)
3 views1 page

Git Commands

Uploaded by

chmuzammil022
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/ 1

1.

git init
Initializes a new Git repository in the current directory.

2.git clone <repository-url>


Creates a local copy of a remote repository.

3.git status
Displays the status of the working directory and staging area.

4.git add <file>


Stages changes for the next commit.

5.git add .
Stages all changes (new, modified, deleted files).

6.git commit -m "<message>"


Records the staged changes in the repository with a commit message.

7.git push <remote> <branch>


Uploads local commits to a remote repository.

8.git pull <remote> <branch>


Fetches and merges changes from a remote repository into the current branch.

9.git log
Shows the commit history for the current branch.

10.git branch
Lists all local branches in the repository.

11.git branch <branch-name>


Creates a new branch.

12.git checkout <branch-name>


Switches to a specified branch.

13.git merge <branch-name>


Merges changes from a specified branch into the current branch.

14.git stash
Stashes uncommitted changes temporarily.

15.git reset <file>


Unstages a specified file.

16.git reset --hard <commit-hash>


Resets the current branch to a specified commit, discarding changes.

17.git diff
Shows differences between files or commits.

18.git tag <tag-name>


Creates a new tag to mark a specific point in history.

19.git remote -v
Lists remote repositories.

20.git fetch <remote>


Downloads changes from a remote repository without merging.

You might also like