GitHunt
RA

rajkumar060301/git-command-cheatseets

This repo is descrive the command line for git and github handling

git-command-cheatseets

  1. Set the user name

git config --global user.name "Your Name"

  1. Set the user email

git config --global user.email "your.email@example.com"

  1. Check the user name

git config --global user.name

  1. check the user email

git config --global user.email

  1. Check the git version

git --version

  1. check current branch

git branch --show-current

git status

  1. check the all branch

git branch -a

  1. check the remote version

git remote -v

  1. rename the remote orgin

git remote rename origin newname

  1. how to commit

git commit -m "Your commit message"

  1. how to add signle file for commit

git add filename

  1. how to add all file for commit

git add .

  1. how create new branch

git branch new-branch-name

  1. how to change branch

git checkout branch-name

git switch branch-name

  1. how to copy one branch to another branch

git checkout -b new-branch-name source-branch-name
git switch -c new-branch-name source-branch-name

16.How to merge code

git checkout target-branch
git merge source-branch

git checkout main
git merge feature-branch

  1. How to set git repo to change or rename current repo

git remote set-url origin reponame

Contributors

Created May 31, 2024
Updated January 12, 2025