-
git init
: This command initializes a new Git repository in the current directory. -
git add
: This command adds changes to the staging area. You can specify individual files or use.
to add all changes.git add <file name>
(for a specific file) orgit add .
(for all files). -
git commit
: This command commits changes to the repository. You can add a message with the-m
flag, like this:git commit -m "Commit message"
. -
git status
: This command shows the status of your repository, including which files have been modified and which are staged for commit. -
git log
: This command shows the commit history of the repository, including who made each commit, when, and the commit message. -
git checkout
: This command allows you to switch between branches or restore a file to a previous version. You can also use it to create a new branch.`git checkout -b <new_branch>` (creates a new branch if not exist and switches to a new branch) `git checkout <existed_branch>` (if the branch already exists)
-
git pull
: This command pulls changes from a remote repository into your local repository. -
git push
: This command pushes changes from your local repository to a remote repository. -
git branch
: This command shows the current branches in your repository. You can use it to create a new branch or delete an existing one. -
git clone
: This command clones a remote repository onto your local machine.
Created
March 17, 2023 07:28
-
-
Save codewithmanas/caa02633ee15d5c01000ee0504f3cc37 to your computer and use it in GitHub Desktop.
10 basic Git commands that every beginner should know.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment