Git How-To Guides
Working Tree and Staging
- Beginner
How to Unstage Files Without Losing Changes in Git
Learn how to unstage files while keeping your changes in the working tree.
- Intermediate
How to Commit Only Selected Lines in Git
Learn how to commit selected lines while leaving other edits for later.
- Intermediate
How to Stash Selected Files in Git
Learn how to stash selected files and inspect their changes before restoring them.
- Beginner
How to Revert a File to a Specific Git Commit
Learn how to restore file contents from a previous Git commit.
- Beginner
How to Stop Tracking a File and Keep It Locally in Git
Learn how to stop tracking a file while keeping your local copy.
- Intermediate
How to Ignore Modified Files in Git
Learn how to ignore modified files that should not be committed.
Branches
- Beginner
How to Checkout a Remote Branch in Git
Learn how to checkout a remote branch that exists on a remote repository but not yet in your local working copy.
- Beginner
How to Rename a Git Branch
Learn how to rename local and remote branches in your Git repository.
- Beginner
How to Delete a Branch in Git
Learn how to safely delete local and remote branches in your Git repository.
- Intermediate
How to Move Commits to Another Branch in Git
Learn how to move commits made on the wrong branch to their intended branch.
Changing Commits
- Beginner
How to Amend the Last Commit in Git
Learn how to change the last commit's message or add missing changes.
- Beginner
How to Undo Last Git Commits
Learn how to undo one or more commits while preserving your changes.
- Intermediate
How to Squash Several Commits into One in Git
Learn how to combine several local commits into one before sharing your work.
- Intermediate
How to Remove a File from a Git Commit
Learn how to remove files that were unintentionally added to a Git commit.