Skip to content

Instantly share code, notes, and snippets.

View smw7156's full-sized avatar

shadman smw7156

View GitHub Profile
@smw7156
smw7156 / Shadman_git_doc.md
Last active November 13, 2025 07:11
Here are some of the command I mostly use,

Git handbook

Difference between commit and files

  • git diff --name-only 4242069 b5011b8 -> only for file changed between two commits
  • git diff b5011b8:StanceBeam/app/src/main/java/stancebeam/quicklogi/com/cricketApp/MainActivity.java 4242069:StanceBeam/app/src/main/java/stancebeam/quicklogi/com/cricketApp/MainActivity.java -> difference between two file from two commits(older commit should be placed first)

For moving any no. of last commit from master to a new branch

@cmatskas
cmatskas / detached-head-merge.ps1
Created August 22, 2015 21:55
Git merge detached head
$git checkout –b temp #makes a new branch from current detached HEAD
$git branch –f master temp #update master to point to the new <temp> branch
$git branch –d temp #delete the <temp> branch
$git push origin master #push the re-established history
@jtdp
jtdp / gist:5443297
Last active April 2, 2025 22:15
See changes before pulling from remote git repository
# fetch the changes from the remote
git fetch origin
# show commit logs of changes
git log master..origin/master
# show diffs of changes
git diff master..origin/master
# apply the changes by merge..