Git Command

Git Command

●5 ●6 ●13
calendar_today • schedule1 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

Git Submodules: When and How

Valentine Shimanovsky - Oct 5

Learn Git fast as if your job depends on it

Nikola Breznjak - Feb 16

Git Sparse Checkout Cone Mode Root Files

raylabs - Nov 11

Git Was Never Built for a Thousand Agents. Here Is How OpenAI Rebuilt the Server Behind It.

ronidas071 - Nov 3

No, Git Isn't Dead. Anthropic's Robots Just Needed a Bigger One.

Hardik Goel - Oct 30
chevron_left
776 Points • 24 Badges
Bangalore,karnataka • dev.to/mirajhad
3Posts
4Comments
8Connections
Software Engineer | R&D Engineering | ASP.NET | React Js

Related Jobs

View all jobs →

Commenters (This Week)

1 comment
1 comment
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!