User setting
Sets the name and email that will be attached to your commits and tags globally
git config --global user.name "<user_name>"
git config --global user.email "<email_address>"
Create local repository
Initializes a new Git repository in your current directory, creating a .git folder
git init
File staging
Adds a file named to the staging area, making it ready for committing
git add <file_name>
Commit
Records or snapshots the staged changes in the repository, with a descriptive message
git commit -m "<commit_message>"
Create branch
Creates a new branch named ( main, feature, etc)
git branch <branch_name>
Switch branch
Switches to the specified branch name , updating the working directory to match
git checkout <branch_name>
Add remote repository
Adds a new remote git repository (origin is often used) as shortname you can reference
git remote add <remote_repository_name> <https://github.com/example.git>
Push
Uploads all local branch commits to the remote repository
git push <remote_repository_name> <branch_name>
Pull
Fetches and integrates changes from the remote branch into your current branch
git pull <remote_repository_name> <branch_name>
Merge
Merges the specified branchās history into the current branch, combining changes
git merge <branch_name>
Top comments (0)