ššš¬š¢š ššØš¦š¦šš§š šØš šš¢š
"Learn Git basics: Initialize, add, commit, push. Lay the foundation for efficient version control and collaborative coding. #Git"
Published Feb 27, 2024
Last Modified Jul 4, 2024
Git provides a powerful set of commands for version control and collaborative software development. Here are some basic Git commands that are commonly used in the version control workflow.
š ššØš§šš¢š š®š«š šš¢š
`š š¢š ššØš§šš¢š ā š š„šØššš„ š®š¬šš«.š§šš¦š āššØš®š« ššš¦šā`: Sets the global username.
`š š¢š ššØš§šš¢š ā š š„šØššš„ š®š¬šš«.šš¦šš¢š„ āš²šØš®š«.šš¦šš¢š„@šš±šš¦š©š„š.ššØš¦ā`: Sets the global email.
`š š¢š ššØš§šš¢š ā š š„šØššš„ š®š¬šš«.š§šš¦š āššØš®š« ššš¦šā`: Sets the global username.
`š š¢š ššØš§šš¢š ā š š„šØššš„ š®š¬šš«.šš¦šš¢š„ āš²šØš®š«.šš¦šš¢š„@šš±šš¦š©š„š.ššØš¦ā`: Sets the global email.
š šš§š¢šš¢šš„š¢š³š š ššš©šØš¬š¢ššØš«š²
`š š¢š š¢š§š¢š` Initializes a new Git repository. This command is run once when you start a new project.
`š š¢š š¢š§š¢š` Initializes a new Git repository. This command is run once when you start a new project.
š šš„šØš§š š ššš©šØš¬š¢ššØš«š²
`š š¢š šš„šØš§š <š«šš©šØš¬š¢ššØš«š²_š®š«š„>` Creates a copy of a remote repository on your local machine. This is the first command you run when you want to start working on an existing project.
`š š¢š šš„šØš§š <š«šš©šØš¬š¢ššØš«š²_š®š«š„>` Creates a copy of a remote repository on your local machine. This is the first command you run when you want to start working on an existing project.
š šš”ššš¤ ššš©šØš¬š¢ššØš«š² ššššš®š¬
`š š¢š š¬šššš®š¬` Shows the status of changes as untracked, modified, or staged.
`š š¢š š¬šššš®š¬` Shows the status of changes as untracked, modified, or staged.
š ššš šš”šš§š šš¬ ššØ šššš š¢š§š šš«šš
`š š¢š ššš <šš¢š„š š§šš¦š>` Adds changes in a specific file to the staging area.
`š š¢š ššš .` Adds all changes in the working directory to the staging area.
`š š¢š ššš <šš¢š„š š§šš¦š>` Adds changes in a specific file to the staging area.
`š š¢š ššš .` Adds all changes in the working directory to the staging area.
š ššØš¦š¦š¢š šš”šš§š šš¬
`š š¢š ššØš¦š¦š¢š -š¦ āššØš¦š¦š¢š š¦šš¬š¬šš šā` Commits the changes in the staging area with a descriptive commit message.
`š š¢š ššØš¦š¦š¢š -š¦ āššØš¦š¦š¢š š¦šš¬š¬šš šā` Commits the changes in the staging area with a descriptive commit message.
š šš¢šš° ššØš¦š¦š¢š šš¢š¬ššØš«š²
`š š¢š š„šØš ` Displays a log of commits, showing commit messages, authors, dates, and commit hashes.
`š š¢š š„šØš ` Displays a log of commits, showing commit messages, authors, dates, and commit hashes.
š šš©šššš ššš¦šØšš ššš©šØš¬š¢ššØš«š²
`š š¢š š©š®š¬š” šØš«š¢š š¢š§ <šš«šš§šš”_š§šš¦š>` Pushes local commits to the remote repository.
`š š¢š š©š®š„š„ šØš«š¢š š¢š§ <šš«šš§šš”_š§šš¦š>` Fetches changes from the remote repository and merges them into the local branch.
`š š¢š š©š®š¬š” šØš«š¢š š¢š§ <šš«šš§šš”_š§šš¦š>` Pushes local commits to the remote repository.
`š š¢š š©š®š„š„ šØš«š¢š š¢š§ <šš«šš§šš”_š§šš¦š>` Fetches changes from the remote repository and merges them into the local branch.
š ššš¦šØšÆš šš§šš«ššš¤šš š
š¢š„šš¬
`š š¢š šš„ššš§ -š§` Shows a list of untracked files that will be removed.
`š š¢š šš„ššš§ -š` Removes untracked files from the working directory.
`š š¢š šš„ššš§ -š§` Shows a list of untracked files that will be removed.
`š š¢š šš„ššš§ -š` Removes untracked files from the working directory.
š šš«šššš šš§š šš©š©š„š² ššššš”šš¬
`š š¢š šš¢šš > š©šššš”šš¢š„š` Creates a patch file from changes.
`š š¢š šš©š©š„š² < š©šššš”šš¢š„š` Applies changes from a patch file.
`š š¢š šš¢šš > š©šššš”šš¢š„š` Creates a patch file from changes.
`š š¢š šš©š©š„š² < š©šššš”šš¢š„š` Applies changes from a patch file.
š šš§ššØ šš”šš§š šš¬
`š š¢š š«šš¬šš <šš¢š„š š§šš¦š>` Unstages changes for a specific file.
`š š¢š š«šš¬šš ā š”šš«š šššš` Discards all changes in the working directory.
`š š¢š š«šš¬šš <šš¢š„š š§šš¦š>` Unstages changes for a specific file.
`š š¢š š«šš¬šš ā š”šš«š šššš` Discards all changes in the working directory.
š šš¢šš° ššš¦šØšš ššš©šØš¬š¢ššØš«š¢šš¬
`š š¢š š«šš¦šØšš -šÆ` Lists the remote repositories configured for the current repository.
`š š¢š š«šš¦šØšš -šÆ` Lists the remote repositories configured for the current repository.
š š
šššš” šš”šš§š šš¬ šš«šØš¦ ššš¦šØšš
`š š¢š ššššš”` Fetches changes from the remote repository without merging them into your working directory.
`š š¢š ššššš”` Fetches changes from the remote repository without merging them into your working directory.
š šš®š„š„ šš”šš§š šš¬ šš«šØš¦ ššš¦šØšš
`š š¢š š©š®š„š„ šØš«š¢š š¢š§ <šš«šš§šš”_š§šš¦š>` Fetches changes and merges them into your local branch.
`š š¢š š©š®š„š„ šØš«š¢š š¢š§ <šš«šš§šš”_š§šš¦š>` Fetches changes and merges them into your local branch.
š šš«šššš š ššš¦šØšš šš«šš§šš”
`š š¢š š©š®š¬š” šØš«š¢š š¢š§ <š„šØššš„_šš«šš§šš”_š§šš¦š>:<š«šš¦šØšš_šš«šš§šš”_š§šš¦š>` Pushes a local branch to create a new remote branch.
`š š¢š š©š®š¬š” šØš«š¢š š¢š§ <š„šØššš„_šš«šš§šš”_š§šš¦š>:<š«šš¦šØšš_šš«šš§šš”_š§šš¦š>` Pushes a local branch to create a new remote branch.
š šš§ššØ šš”š ššš¬š ššØš¦š¦š¢š
`š š¢š š«šš¬šš šššš~1` Undoes the last commit, keeping the changes in your working directory.
`š š¢š š«šš¬šš šššš~1` Undoes the last commit, keeping the changes in your working directory.
š šš¦šš§š šš”š ššš¬š ššØš¦š¦š¢š
`š š¢š ššØš¦š¦š¢š ā šš¦šš§š` Adds changes to the previous commit and allows you to edit the commit message.
`š š¢š ššØš¦š¦š¢š ā šš¦šš§š` Adds changes to the previous commit and allows you to edit the commit message.
š ššš ššØš šØš šš”šš§š šš¬
`š š¢š š„šØš ` Displays the commit history.
`š š¢š š„šØš ` Displays the commit history.
š ššš ššØš š°š¢šš” šš«šš©š”š¢ššš„ ššš©š«šš¬šš§šššš¢šØš§
`š š¢š š„šØš ā š š«šš©š” ā šØš§šš„š¢š§š ā šš„š„` Shows a concise commit history with a graphical representation.
`š š¢š š„šØš ā š š«šš©š” ā šØš§šš„š¢š§š ā šš„š„` Shows a concise commit history with a graphical representation.
š ššš šš”šš§š šš¬ š¢š§ ššØš«š¤š¢š§š šš¢š«ššššØš«š²
`š š¢š šš¢šš` Shows changes in the working directory that are not staged.
Ā
`š š¢š šš¢šš` Shows changes in the working directory that are not staged.
Ā