Fundamentals 8 min read

Comprehensive Git Guide: Introduction, Installation, Registration, Configuration, and Common Operations

This article provides a comprehensive guide to Git, covering its purpose, installation on Windows, Linux, and macOS, account registration, SSH key setup, creating repositories, cloning, branch management, merging, conflict resolution, and version rollback procedures.

Test Development Learning Exchange
Test Development Learning Exchange
Test Development Learning Exchange
Comprehensive Git Guide: Introduction, Installation, Registration, Configuration, and Common Operations

Git is an open‑source distributed version control system created by Linus Torvalds to help manage Linux kernel development. Unlike CVS or Subversion, Git uses a distributed repository model that does not require server‑side software.

Installation: on Windows download from https://git-scm.com/download/win and run the installer; on Linux use apt-get install git or yum install git ; on macOS use brew install git .

Registration: visit https://github.com/ , click “Sign up for GitHub”, provide a nickname (letters, numbers, hyphens only), a valid unused email, and a password of at least 7 characters with at least one lowercase letter and one digit, then choose a public or private repository.

SSH key configuration (example for macOS): check ~/.ssh for existing keys, generate a new one with ssh-keygen -t rsa -C "youremail" , then display the public key using cat ~/.ssh/id_rsa.pub and add it to your GitHub account.

Creating a remote repository: log in to GitHub, click the “+” next to your account name, select “New repository”, fill in the details, and create the repository.

Cloning and local work: create a local folder, e.g., mkdir git_demo , then clone the remote repository with git clone [email protected]:huaan9527/huaangit.git . Edit files, add changes with git add , check status with git status , commit using git commit -m "Add test file" , and push with git push .

Branch operations: list local branches with git branch , all branches with git branch -a , create and switch to a new branch using git checkout -b branch1 , make edits, commit, and push with git push --set-upstream origin branch1 . Delete a local branch via git branch -d branch1 , switch to master with git checkout master , and delete the remote branch using git push origin :branch1 .

Merging branches: create a branch git checkout -b mergedemo , edit files, commit and push, then switch back to master and merge with git merge mergedemo , finally push the merged result.

Conflict resolution: make conflicting changes in the master and mergedemo branches, merge to produce conflict markers, resolve the conflicts, then git add , git commit -m "Resolve conflict" , and git push .

Version rollback: view commit history with git reflog , revert to the previous commit using git reset --hard HEAD^ , or revert to a specific commit with git reset --hard <commit-id> .

gitconflict resolutionmergeInstallationversion controlbranch managementRollback
Test Development Learning Exchange
Written by

Test Development Learning Exchange

Test Development Learning Exchange

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.