Git Command

Git Command

5 6 12
calendar_todayschedule1 min read

The Clean All (discard all changes)

git clean -fd

How do you move a commit to the staging area in git?

git reset --soft HEAD~1

Pushing empty commits to remote

git commit --allow-empty -m "Trigger Build"

History

git log --graph --color --decorate --oneline --all
gitk --all

Git to discard uncommitted changes in your working directory

git restore .

Moves the last commit back to the staging area (index), keeping all changes.

git reset --soft HEAD~

Moves the last commit back to the staging area (index), Discard all changes.

git reset --hard HEAD~

Deletes a local branch named branch_name.

git branch -d branch_name

Force Delete a Branch (If Not Merged):

git branch -D branch_name

Delete a Remote Branch:

git push origin --delete branch_name

List both local & remote branches:

git branch -a

Prunes (removes) local references to remote branches that no longer exist on the remote.

git fetch --prune

Quickly Switch to the Previous Branch

git checkout -

Show a Visual Branch Tree

git log --oneline --graph --all

Search Commit Messages

git log --grep="bugfix"

Configures Git to use Windows' built-in SSL/TLS (Schannel) instead of OpenSSL

git config --global https.sslBackend schannel

Trigger the CI/CD pipeline with a blank commit

git commit --allow-empty -m 'Empty commit'

visualizing Git history

gitk

How do you move a commit to the staging area in git?

git reset --soft HEAD~1

Git to discard uncommitted changes in your working directory

git restore .

source:- link

🔥 Join developers growing publicly
Share your knowledge, build in public, and grow your developer presence with a global community.

More Posts

Learn Git fast as if your job depends on it

Nikola Breznjak - Feb 16

Codicology for Compiled Code: Triangulating Authorship When Git Blame Lies

Alex - Jul 4

The real risk was not the code I could see. It was the code Git could run for me.

JustineDevs - Jul 1

Confessions of a Git Beginner: Why the Terminal Stopped Scaring Me

Bramwel M.M - Jun 22

I Added an AI Gate Before Every git push with no-mistakes ️

Divyesh - Jun 13
chevron_left
776 Points23 Badges
Bangalore,karnatakadev.to/mirajhad
3Posts
4Comments
8Connections
Software Engineer | R&D Engineering | ASP.NET | React Js

Related Jobs

View all jobs →

Commenters (This Week)

2 comments
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!