Git/GitHub Commands

Git is a version control system that helps track code changes, manage versions, and enable collaboration among developers. GitHub is an online platform that hosts Git repositories, allowing you to store code in the cloud and collaborate with others. git init Initializes a new Git repository in your current project directory. git add Stages changes (files) to be committed to the repository. git commit Commits the staged changes with a message to the local repository. git push Pushes local commits to a remote repository (e.g., GitHub). git status Displays the state of the working directory and staging area. git log Shows the commit history of the repository. git branch Lists all branches or creates a new branch. git branch -M Renames a branch, forcing the rename if necessary. git config username Sets the Git username for commit authorship. git config email Sets the Git email address for commit authorship. git remote add origin Links your local repository to a remote repository.

Apr 23, 2025 - 19:00
 0
Git/GitHub Commands

Git is a version control system that helps track code changes, manage versions, and enable collaboration among developers. GitHub is an online platform that hosts Git repositories, allowing you to store code in the cloud and collaborate with others.

git init

Initializes a new Git repository in your current project directory.

git add

Stages changes (files) to be committed to the repository.

git commit

Commits the staged changes with a message to the local repository.

git push

Pushes local commits to a remote repository (e.g., GitHub).

git status

Displays the state of the working directory and staging area.

git log

Shows the commit history of the repository.

git branch

Lists all branches or creates a new branch.

git branch -M

Renames a branch, forcing the rename if necessary.

git config username

Sets the Git username for commit authorship.

git config email

Sets the Git email address for commit authorship.

git remote add origin

Links your local repository to a remote repository.

Screenshot of GitHub repository showing commit history
Example of Git status output in terminal showing modified and untracked files
GitHub interface showing the process of pushing code to a remote repository
Terminal output showing the use of git add and git commit commands