Contents

git commands

Contents

Most useful git commands.

intro

Here i summarises the all git commands which is used frequently. It helps developers manage and track changes in their projects.

1
2
# Initializes a new Git repository in the current directory.
git init
1
2
# To configure the the email id in local git repo.
git config --global user.email "your_email_id"
1
2
# To configure the username in the local git repo.
git config --global user.name "your-user-name"
1
2
# To check the user email in git local repo.
git config --global user.email
1
2
# Adds a file or directory to the staging area, preparing it to be committed.
git add .
1
2
# to commmit all the changes.
git commit -m "commit_message"
1
2
# Uploads local repository changes to the remote repository.
git push -u origin main
1
echo "# test" >> README.md
1
git add README.md
1
git branch -M main
1
git remote add origin https://github.com/sumit2011/test.git
1
git clone <repo_link>
1
git add <file_name>
1
git status
1
git config
1
git pull
1
git config
1
2
# To show the details of the commits.
git log
1
git remote -v