0% found this document useful (0 votes)
4 views4 pages

Git Commands Complete Documentation

This document provides a comprehensive guide on using Git and terminal commands, detailing syntax, descriptions, and expected outputs for various commands. Key commands include creating directories, initializing repositories, configuring user information, and managing files and commits. It also covers branching and pushing changes to remote repositories.

Uploaded by

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

Git Commands Complete Documentation

This document provides a comprehensive guide on using Git and terminal commands, detailing syntax, descriptions, and expected outputs for various commands. Key commands include creating directories, initializing repositories, configuring user information, and managing files and commits. It also covers branching and pushing changes to remote repositories.

Uploaded by

ukkumaa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Git and Terminal Commands

Documentation
mkdir vkr
Syntax: mkdir <directory-name>

Description: Creates a new directory called 'vkr'.

Output: No output for this command.

cd vkr
Syntax: cd <directory-name>

Description: Changes the directory to 'vkr'.

Output: No output for this command.

git init
Syntax: git init

Description: Initializes a new Git repository in the current directory.

Output: Initialized empty Git repository in C:/Users/mahes/vkr/.git

pwd
Syntax: pwd

Description: Prints the current working directory.

Output: /c/Users/mahes/vkr

git config --global [Link] 'maheswaramsubrahmanyam'


Syntax: git config --global [Link] '<username>'

Description: Sets the global Git username.

Output: No output for this command.


git config --global [Link]
'maheswaramsubrahmanyam2004@[Link]'
Syntax: git config --global [Link] '<email>'

Description: Sets the global Git user email.

Output: No output for this command.

echo 'this is text file' [Link]


Syntax: echo '<text>' [Link]

Description: Writes the specified text into '[Link]'.

Output: this is text file [Link]

echo 'this is text file' > [Link]


Syntax: echo '<text>' > [Link]

Description: Writes the specified text into a new file '[Link]'.

Output: No output for this command.

ls
Syntax: ls

Description: Lists the files in the current directory.

Output: [Link]

git add [Link]


Syntax: git add <filename>

Description: Adds '[Link]' to the staging area.

Output: warning: in the working copy of '[Link]', LF will be replaced by CRLF the next time
Git touches it.

git commit -m 'committed-1' [Link]


Syntax: git commit -m '<message>' <filename>

Description: Commits the '[Link]' file with the message 'committed-1'.


Output: [master (root-commit) d07cc4b] committed-1
1 file changed, 1 insertion(+)
create mode 100644 [Link]

git remote add origin <url>


Syntax: git remote add origin <url>

Description: Adds a remote repository to track changes.

Output: No output for this command.

git push origin --all


Syntax: git push origin --all

Description: Pushes all commits to the remote repository.

Output: Enumerating objects: 3, done.


Counting objects: 100% (3/3), done.
Writing objects: 100% (3/3), 231 bytes | 231.00 KiB/s, done.

git status
Syntax: git status

Description: Displays the state of the working directory and staging area.

Output: On branch master


nothing to commit, working tree clean

git log
Syntax: git log

Description: Shows the commit history.

Output: commit d07cc4b (HEAD -> master, origin/master)


Author: maheswaramsubrahmanyam <maheswaramsubrahmanyam2004@[Link]>
Date: Mon Oct 7 [Link] 2024 +0530
committed-1

git log --all --graph --decorate --oneline


Syntax: git log --all --graph --decorate --oneline

Description: Shows the commit history in a graph-like structure with decorations.


Output: * d07cc4b (HEAD -> master, origin/master) committed-1

git checkout <branch>


Syntax: git checkout <branch>

Description: Switches to the specified branch.

Output: Switched to branch 'branch-name'

git branch <branch-name>


Syntax: git branch <branch-name>

Description: Creates a new branch with the specified name.

Output: No output for this command.

git commit -m 'end the changes in the second-branch'


Syntax: git commit -m '<message>'

Description: Commits the staged changes with the specified message.

Output: [second-branch 91f30fe] end the changes in the second-branch


1 file changed, 1 insertion(+)

You might also like