ML workshop day2

git rebase
Reapplies commits on top of another base tip.

Used for cleaner history compared to merge.

bash
Copy
Edit
git rebase main
Interactive rebase (edit, squash, reorder commits):

bash
Copy
Edit
git rebase -i HEAD~5

git cherry-pick
Apply a s…


This content originally appeared on DEV Community and was authored by Harish .R

  1. git rebase Reapplies commits on top of another base tip.

Used for cleaner history compared to merge.

bash
Copy
Edit
git rebase main
Interactive rebase (edit, squash, reorder commits):

bash
Copy
Edit
git rebase -i HEAD~5

  1. git cherry-pick Apply a specific commit from one branch onto another.

bash
Copy
Edit
git cherry-pick

  1. git stash Temporarily save uncommitted changes without committing them.

Save changes:

bash
Copy
Edit
git stash
Apply last stash:

bash
Copy
Edit
git stash apply
See stash list:

bash
Copy
Edit
git stash list

  1. git reflog Shows the history of all HEAD movements.

Useful to recover lost commits.

bash
Copy
Edit
git reflog

  1. git reset Undo commits.

Soft reset (keep changes staged):

bash
Copy
Edit
git reset --soft HEAD~1
Mixed reset (unstage changes):

bash
Copy
Edit
git reset --mixed HEAD~1
Hard reset (destroy changes):

bash
Copy
Edit
git reset --hard HEAD~1

  1. git bisect Binary search through commits to find which commit introduced a bug.

bash
Copy
Edit
git bisect start
git bisect bad
git bisect good

  1. git blame Show who made each change to a file.

bash
Copy
Edit
git blame

  1. git clean Remove untracked files from the working directory.

Dry run (show what would be deleted):

bash
Copy
Edit
git clean -n
Actually delete:

bash
Copy
Edit
git clean -f

  1. git tag Mark specific points in history as important (like releases).

Create lightweight tag:

bash
Copy
Edit
git tag v1.0
Create annotated tag:

bash
Copy
Edit
git tag -a v1.0 -m "Release version 1.0"

  1. git submodule Manage repositories inside repositories.

Add submodule:

bash
Copy
Edit
git submodule add
Initialize submodules:

bash
Copy
Edit
git submodule init
git submodule update

  1. git log --graph --oneline --all Visualize the repository history in a tree format.

bash
Copy
Edit
git log --graph --oneline --all

  1. git diff Show changes between commits, branches, or working directory.

Compare working directory to staging:

bash
Copy
Edit
git diff
Compare two branches:

bash
Copy
Edit
git diff branch1..branch2


This content originally appeared on DEV Community and was authored by Harish .R


Print Share Comment Cite Upload Translate Updates
APA

Harish .R | Sciencx (2025-04-28T17:52:59+00:00) ML workshop day2. Retrieved from https://www.scien.cx/2025/04/28/ml-workshop-day2/

MLA
" » ML workshop day2." Harish .R | Sciencx - Monday April 28, 2025, https://www.scien.cx/2025/04/28/ml-workshop-day2/
HARVARD
Harish .R | Sciencx Monday April 28, 2025 » ML workshop day2., viewed ,<https://www.scien.cx/2025/04/28/ml-workshop-day2/>
VANCOUVER
Harish .R | Sciencx - » ML workshop day2. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/04/28/ml-workshop-day2/
CHICAGO
" » ML workshop day2." Harish .R | Sciencx - Accessed . https://www.scien.cx/2025/04/28/ml-workshop-day2/
IEEE
" » ML workshop day2." Harish .R | Sciencx [Online]. Available: https://www.scien.cx/2025/04/28/ml-workshop-day2/. [Accessed: ]
rf:citation
» ML workshop day2 | Harish .R | Sciencx | https://www.scien.cx/2025/04/28/ml-workshop-day2/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.