Computer Fundamentals notes for BCA 1st SEM pdf in English, computer fundamentals notes pdf, Fundamentals of Computer BCA 1st Sem textbook PDF

Git Cheat Sheet for Developers with Examples PDF

Hey there, here is the Git cheatsheet with the most important and commonly used Git commands and also you can Download the PDF of this cheatsheet from the link given below for FREE 🤩


Git Basics

1. Initialize a Repository

It is used to initialize a new Git repository in the current directory.

git init


2. Clone a Repository

This command is used to create copies of a remote repository to your local machine.

git clone <repository_url>


Also Read: 50 HTML Tags and their functions with Example: Click Here


3. Check Repository Status

This git command shows the status of changes as untracked, modified, or staged of a repository.

git status


4. Stage Changes

This command adds specified file changes to the staging area.

git add <file(s)>


5. Commit Changes

This git command records staged changes with a descriptive message.

git commit -m "Commit message"


6. View Commit History

This git command is used to display a chronological list of commits.

git log

Branching and Merging

1. Create a New Branch

This git command is used to creates a new branch.

git branch <branch_name>


2. Switch to a Branch

This git command is used to moves to the specified branch.

git checkout <branch_name>

or, in newer Git versions

git switch <branch_name>


3. Merge Branches

This command combines changes from the specified branch into the current branch.

git merge <branch_name>


Also Read: 50 HTML Tags and their functions with Example: Click Here


4. Delete a Branch

This git command deletes the specified branch.

git branch -d <branch_name>

Remote Repositories

1. Add a Remote Repository

This git command links a remote repository to your local repository.

git remote add <remote_name> <repository_url>


2. Fetch Changes from a Remote

It retrieves changes from a remote repository without merging.

git fetch <remote_name>


3. Pull Changes from a Remote

This git command fetches changes and merges them into the current branch.

git pull <remote_name> <branch_name>


4. Push Changes to a Remote

This command is used to upload local branch changes to the remote repository.

git push <remote_name> <branch_name>

Undoing Changes

1. Discard Uncommitted Changes

It is used to discard changes in the working directory.

git restore <file(s)>


2. Undo the Last Commit (keep changes)

This git command undoes the last commit while keeping changes staged.

git reset HEAD^

To discard changes:

git reset --hard HEAD^


3. Revert a Commit

This command creates a new commit that undoes the changes of a previous commit.

git revert <commit_hash>

Miscellaneous

1. Configure Git

It is used to set your global Git username.

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

It sets your global Git email.

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


2. Ignore Files

Create a '.gitignore' file and list files/directories to be ignored.


3. Stash Changes

This git command temporarily save changes that are not ready to be committed.

To apply stashed changes:

git stash

Restores the latest stashed changes.

git stash apply


Also Read: 50 HTML Tags and their functions with Example: Click Here

I hope this Git cheatsheet will be helpful for you. And you will defiantly enjoy this and also you will use it as reference while building projects. So you can now download PDF of this Git cheatsheet from the link given below 👇🏻  

Git Cheat Sheet for Developers with Examples PDF Download: Download Now

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.

Top Post Ad

Below Post Ad

Ads Section