๐๐๐ฌ๐ข๐ ๐๐จ๐ฆ๐ฆ๐๐ง๐ ๐จ๐ ๐๐ข๐ญ
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.
๐ ๐๐ง๐ข๐ญ๐ข๐๐ฅ๐ข๐ณ๐ ๐ ๐๐๐ฉ๐จ๐ฌ๐ข๐ญ๐จ๐ซ๐ฒ
`๐ ๐ข๐ญ ๐ข๐ง๐ข๐ญ` 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.
๐ ๐๐ก๐๐๐ค ๐๐๐ฉ๐จ๐ฌ๐ข๐ญ๐จ๐ซ๐ฒ ๐๐ญ๐๐ญ๐ฎ๐ฌ
`๐ ๐ข๐ญ ๐ฌ๐ญ๐๐ญ๐ฎ๐ฌ` 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.
๐ ๐๐จ๐ฆ๐ฆ๐ข๐ญ ๐๐ก๐๐ง๐ ๐๐ฌ
`๐ ๐ข๐ญ ๐๐จ๐ฆ๐ฆ๐ข๐ญ -๐ฆ โ๐๐จ๐ฆ๐ฆ๐ข๐ญ ๐ฆ๐๐ฌ๐ฌ๐๐ ๐โ` 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.
๐ ๐๐ฉ๐๐๐ญ๐ ๐๐๐ฆ๐จ๐ญ๐ ๐๐๐ฉ๐จ๐ฌ๐ข๐ญ๐จ๐ซ๐ฒ
`๐ ๐ข๐ญ ๐ฉ๐ฎ๐ฌ๐ก ๐จ๐ซ๐ข๐ ๐ข๐ง <๐๐ซ๐๐ง๐๐ก_๐ง๐๐ฆ๐>` 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.
๐ ๐๐ซ๐๐๐ญ๐ ๐๐ง๐ ๐๐ฉ๐ฉ๐ฅ๐ฒ ๐๐๐ญ๐๐ก๐๐ฌ
`๐ ๐ข๐ญ ๐๐ข๐๐ > ๐ฉ๐๐ญ๐๐ก๐๐ข๐ฅ๐` 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.