RA
rajkumar060301/git-command-cheatseets
This repo is descrive the command line for git and github handling
git-command-cheatseets
- Set the user name
git config --global user.name "Your Name"
- Set the user email
git config --global user.email "your.email@example.com"
- Check the user name
git config --global user.name
- check the user email
git config --global user.email
- Check the git version
git --version
- check current branch
git branch --show-current
git status
- check the all branch
git branch -a
- check the remote version
git remote -v
- rename the remote orgin
git remote rename origin newname
- how to commit
git commit -m "Your commit message"
- how to add signle file for commit
git add filename
- how to add all file for commit
git add .
- how create new branch
git branch new-branch-name
- how to change branch
git checkout branch-name
git switch branch-name
- 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
- How to set git repo to change or rename current repo
git remote set-url origin reponame
On this page
Contributors
Created May 31, 2024
Updated January 12, 2025