Git comments for command line

Git Version control system

Git is a distributed version-control system for tracking changes in source code during software development. It is designed for coordinating work among programmers

SCM Git is Software Configuration Management
SVN is a Version Control System (VCS) tool
Git is a Revision control system, a tool to manage your source code history.
GitHub is a hosting service for Git repositories.


GUI Tools for Git:
Source Tree - https://www.sourcetreeapp.com/
Android Studio has VCS (For Android developer)
Tortoise Git - https://tortoisegit.org/

Check Git version
git --version

Add login credentials
git config --global user.name "Your username"
git config --global user.email "your git email:
git config --global user.password "your git password"

Check your git information
git config --global --list

Initialize a local directory
git init

Clone repository
git clone "Repository URL"

Clone from a specific branch
git clone -b <branch_name> <remote_url>

Switch the branch
git checkout -b "branch name"

Download the latest changes
git pull <remote name> <branch name>

View remote repository
git remote -v

Add a remote repository
git remote add <remote name> <repository url>

Create a branch
git checkout -b <branch name>

Existing branch
git checkout <branch name>

View the changes
git status

View the difference
git diff

Add the file/folder in local repository
git add file/folder-name

Add all files/folders in local repository
git add .

Commit the local changes
git commit -m "Comments"

Send the changes to the cloud (GitHub, bitbucket, gitlab)
git push remote-name branch-name

Delete all the changes
git checkout .

Undo delete
git reset .

Merge a branch with the master branch
git checkout branch-name
git merge master

Comments

Popular posts from this blog

Your build is currently configured to use incompatible Java 21.0.3 and Gradle 8.2.1. Cannot sync the project.

Google Assistant Implementation in Android application with app actions