### Getting Started

- [Installing Git](/git/install-git)
- [Getting started with Tower](/git/tower)

### Fundamentals

- [Creating a repository](/git/creating-a-repository)
- [Committing file changes](/git/committing-file-changes)
- [Ignoring unwanted files](/git/ignoring-files)
- [Viewing historical changes](/git/viewing-previous-commits)
- [Publishing local changes](/git/publishing-local-changes)
- [Cloning an existing repository](/git/cloning-an-existing-repository)
- [Reverting and undoing commits](/git/reverting-commits)
- [Cherry-picking commits](/git/cherry-picking-commits)

### Advanced

- [How to create branches and merge them using Git](/git/branching-and-merging)
- [How to deploy a website using Git](/git/deploy-websites-with-git)
- [Git for Developers: Tips and tricks](/git/git-for-developers)
- [Managing Large Files with Git LFS](/git/managing-git-lfs-and-deployhq)
- [Mastering Git Commit Messages with AI](/git/mastering-git-commit-with-ai)
- [Best Practices for Committing AI-Generated Code](/git/committing-ai-generated-code)
- [Resolving Merge Conflicts with AI](/git/resolving-merge-conflicts-with-ai)
- [Generating Changelogs and Release Notes with AI](/git/generating-changelogs-with-ai)
- [AI-Powered Code Review Before Committing](/git/ai-code-review-before-committing)
- [Writing Pull Request Descriptions with AI](/git/writing-pull-request-descriptions-with-ai)
- [Using AI in Git Hooks for Pre-Commit Checks](/git/ai-git-hooks)
- [Removing Large Files from Git History](/git/removing-large-files-from-git-history)
- [Creating branches](/git/creating-a-branch)

### Commands

- [git branch](/git/commands/branch)
- [git status](/git/commands/status)
- [git checkout: Switch Branches, Restore Files & Detached HEAD](/git/commands/git-checkout)
- [git merge](/git/commands/git-merge)
- [git log](/git/commands/git-log)
- [git stash](/git/commands/git-stash)
- [git tag](/git/commands/git-tag)
- [git fetch](/git/commands/git-fetch)
- [git pull](/git/commands/git-pull)
- [git push](/git/commands/git-push)
- [git remote](/git/commands/git-remote)
- [git submodule](/git/commands/git-submodule)
- [git add](/git/commands/add)
- [git commit](/git/commands/git-commit)
- [git diff](/git/commands/git-diff)
- [git init](/git/commands/git-init)
- [git clone](/git/commands/git-clone)
- [git reset: Soft, Mixed & Hard Reset Examples (with Recovery)](/git/commands/git-reset)
- [git rebase](/git/commands/git-rebase)
- [git cherry-pick](/git/commands/git-cherry-pick)
- [git config](/git/commands/git-config)
- [git blame](/git/commands/git-blame)

### FAQs

- [How do I delete a branch in Git?](/git/faqs/how-to-delete-a-branch-in-git)
- [How can I remove a large file from my commit history?](/git/faqs/removing-large-files-from-git-history)
- [How do I manage files that are in the path of a previous Git submodule?](/git/faqs/add-files-git-submodule-path)
- [How to resolve merge conflicts](/git/faqs/resolve-merge-conflicts-git)
- [How to move a subdirectory into a separate Git repository](/git/faqs/detatch-subdirectory-git-submodule)
- [How do I authenticate with GitHub when pushing commits?](/git/faqs/cache-github-credentials-pushing-commits)
- [How can I change the author of multiple Git commits?](/git/faqs/update-author-committer-multiple-git-commits)
- [How do I rename a branch in Git?](/git/faqs/rename-a-branch-in-git)
- [How do I squash multiple commits into one?](/git/faqs/squash-multiple-commits-git)
- [git reset vs git revert: The Difference (with Decision Rule)](/git/faqs/difference-git-reset-revert)
- [How do I recover a deleted branch in Git?](/git/faqs/recover-deleted-branch-git)
- [How are "git fetch" and "git pull" different?](/git/faqs/difference-between-git-fetch-and-git-pull)
- [How do I clone a specific branch in Git?](/git/faqs/clone-specific-branch-git)
- [How do I use AI to write better git commit messages?](/git/faqs/ai-git-commit-messages)
- [How do I review AI-generated code before committing?](/git/faqs/review-ai-generated-code-before-committing)
- [How do I resolve merge conflicts with AI assistance?](/git/faqs/resolve-merge-conflicts-with-ai)
- [How do I generate a changelog from my git history using AI?](/git/faqs/generate-changelog-git-ai)
- [How do I add AI-powered checks to my git pre-commit hooks?](/git/faqs/ai-pre-commit-hooks-git)
- [How can I clean up deleted branches?](/git/faqs/how-to-clean-up-deleted-branches)
- [What is a "detached HEAD" in a Git repository?](/git/faqs/what-is-git-detached-head)
- [How do I undo my last commit?](/git/faqs/undo-last-git-commit)
- [How can I edit my last commit message?](/git/faqs/edit-last-commit-message)
- [How can I revert a Git repository to a previous commit?](/git/faqs/revert-git-repository-previous-commit)
- [How do I undo the most recent local commits in Git?](/git/faqs/undo-recent-commits-git)
- [How can I make Git “forget” about a file that was tracked but is now in .gitignore?](/git/faqs/forget-tracked-files-gitignore)

Menu
# Learn how to use Git

Free tutorials and resources to help you learn the basics of version control using Git.

## Getting Started

Step-by-step instructions to help you install and configure Git.

[
### Installing Git

Install Git on Windows, Mac, or Linux in under 5 minutes. Includes PATH setup, default branch config, and fixes for the 'git not recognized' error.

](/git/install-git)[
### Getting started with Tower

Get started with Tower, a powerful Git GUI for Mac and Windows. Learn how to install Tower, connect GitHub or GitLab, clone repositories, and manage branches visually.

](/git/tower)

## Fundamentals

Learn all the basic commands necessary to begin using Git on your own.

[
### Creating a repository

Wondering how to create a new repository with Git? This beginner-friendly tutorial will walk you through creating your first Git repository on Windows, Mac, and Linux.

](/git/creating-a-repository)[
### Committing file changes

Learn how to make your first Git commit with step-by-step instructions. See how to use both the git add and git commit commands to take snapshots of file changes.

](/git/committing-file-changes)[
### Ignoring unwanted files

Learn how to use .gitignore to exclude files and folders from your Git repository. Covers pattern syntax, real-world templates, ignoring already-tracked files, global gitignore, and debugging with git check-ignore.

](/git/ignoring-files)[
### Viewing historical changes

Use git log to view commit history, filter by author or date, and format output with --oneline and --graph. Plus git show for inspecting individual commits.

](/git/viewing-previous-commits)[
### Publishing local changes

Learn how to publish your local Git repository for the first time with simple step-by-step instructions. See how to push to a remote GitHub repository via both HTTPS and SSH.

](/git/publishing-local-changes)[
### Cloning an existing repository

Learn how to clone a remote repository using Git with simple step-by-step instructions. See how to download a remote GitHub repository via both HTTPS and SSH URLs.

](/git/cloning-an-existing-repository)[
### Reverting and undoing commits

Undo a Git commit safely with `git revert`, rewrite history with `git reset`, or restore individual files. When to use each, with practical examples.

](/git/reverting-commits)[
### Cherry-picking commits

Cherry-pick a commit from one Git branch to another with `git cherry-pick`. How to handle ranges, merges, conflicts, and when to use rebase or merge instead.

](/git/cherry-picking-commits)

## Advanced

Advanced usage of Git.

[
### How to create branches and merge them using Git

Using branches and merges to independently work on your app without affecting others. Management of branches both locally, and remotely.

](/git/branching-and-merging)[
### How to deploy a website using Git

Explore various Git deployment strategies for your server. From simple git pull to automated CI/CD pipelines, learn how to streamline your workflow and deploy code efficiently.

](/git/deploy-websites-with-git)[
### Git for Developers: Tips and tricks

Master Git with these practical tips and tricks. Learn how to improve your workflow, optimize your commits, and become a Git pro. Perfect for developers of all levels.

](/git/git-for-developers)[
### Managing Large Files with Git LFS 

Learn how Git LFS interacts with deployment pipelines, why pointer files break builds, and how to configure your workflow so large files deploy correctly every time.

](/git/managing-git-lfs-and-deployhq)[
### Mastering Git Commit Messages with AI

Your commit messages are your deployment audit trail. Learn how structured commits improve rollbacks, CI/CD pipelines, and automated changelogs.

](/git/mastering-git-commit-with-ai)[
### Best Practices for Committing AI-Generated Code

Learn how to safely commit AI-generated code using Git. Covers reviewing AI output, writing honest commit messages, testing, avoiding common pitfalls, and deployment best practices.

](/git/committing-ai-generated-code)[
### Resolving Merge Conflicts with AI

Use AI tools like GitHub Copilot, Cursor, and Claude to resolve Git merge conflicts faster. Learn how to give AI the right context and when to resolve conflicts manually.

](/git/resolving-merge-conflicts-with-ai)[
### Generating Changelogs and Release Notes with AI

Use AI to automatically generate changelogs and release notes from your Git history. Learn about Conventional Commits, git-cliff, Release Please, and AI prompts for clean changelog generation.

](/git/generating-changelogs-with-ai)[
### AI-Powered Code Review Before Committing

Use AI tools like GitHub Copilot, Cursor, and CodeRabbit to review code before you commit. Catch bugs, security issues, and quality problems at the cheapest point in the development cycle.

](/git/ai-code-review-before-committing)[
### Writing Pull Request Descriptions with AI

Use GitHub Copilot, Claude, and other AI tools to write better pull request descriptions faster. Learn how to prompt AI with git diffs and logs to generate clear, useful PR summaries.

](/git/writing-pull-request-descriptions-with-ai)[
### Using AI in Git Hooks for Pre-Commit Checks

Add AI-powered quality checks to your Git pre-commit workflow. Learn how to use the pre-commit framework, Husky, Gitleaks, and AI tools to catch issues before they enter your repository.

](/git/ai-git-hooks)[
### Removing Large Files from Git History

Learn how to permanently delete large files, secrets, or build artifacts from your Git history using git filter-repo and BFG, then force-push safely.

](/git/removing-large-files-from-git-history)[
### Creating branches

Create a new Git branch with `git switch -c`, `git checkout -b`, or `git branch`. Modern syntax, naming conventions, tracking remotes, and cloning a single branch.

](/git/creating-a-branch)

## More resources

[
### Git Commands

Reference guides for common Git commands.

](/git/commands)[
### Git FAQs

Answers to common Git questions.

](/git/faqs)

Close
### Getting Started

- [Installing Git](/git/install-git)
- [Getting started with Tower](/git/tower)

### Fundamentals

- [Creating a repository](/git/creating-a-repository)
- [Committing file changes](/git/committing-file-changes)
- [Ignoring unwanted files](/git/ignoring-files)
- [Viewing historical changes](/git/viewing-previous-commits)
- [Publishing local changes](/git/publishing-local-changes)
- [Cloning an existing repository](/git/cloning-an-existing-repository)
- [Reverting and undoing commits](/git/reverting-commits)
- [Cherry-picking commits](/git/cherry-picking-commits)

### Advanced

- [How to create branches and merge them using Git](/git/branching-and-merging)
- [How to deploy a website using Git](/git/deploy-websites-with-git)
- [Git for Developers: Tips and tricks](/git/git-for-developers)
- [Managing Large Files with Git LFS](/git/managing-git-lfs-and-deployhq)
- [Mastering Git Commit Messages with AI](/git/mastering-git-commit-with-ai)
- [Best Practices for Committing AI-Generated Code](/git/committing-ai-generated-code)
- [Resolving Merge Conflicts with AI](/git/resolving-merge-conflicts-with-ai)
- [Generating Changelogs and Release Notes with AI](/git/generating-changelogs-with-ai)
- [AI-Powered Code Review Before Committing](/git/ai-code-review-before-committing)
- [Writing Pull Request Descriptions with AI](/git/writing-pull-request-descriptions-with-ai)
- [Using AI in Git Hooks for Pre-Commit Checks](/git/ai-git-hooks)
- [Removing Large Files from Git History](/git/removing-large-files-from-git-history)
- [Creating branches](/git/creating-a-branch)

### Commands

- [git branch](/git/commands/branch)
- [git status](/git/commands/status)
- [git checkout: Switch Branches, Restore Files & Detached HEAD](/git/commands/git-checkout)
- [git merge](/git/commands/git-merge)
- [git log](/git/commands/git-log)
- [git stash](/git/commands/git-stash)
- [git tag](/git/commands/git-tag)
- [git fetch](/git/commands/git-fetch)
- [git pull](/git/commands/git-pull)
- [git push](/git/commands/git-push)
- [git remote](/git/commands/git-remote)
- [git submodule](/git/commands/git-submodule)
- [git add](/git/commands/add)
- [git commit](/git/commands/git-commit)
- [git diff](/git/commands/git-diff)
- [git init](/git/commands/git-init)
- [git clone](/git/commands/git-clone)
- [git reset: Soft, Mixed & Hard Reset Examples (with Recovery)](/git/commands/git-reset)
- [git rebase](/git/commands/git-rebase)
- [git cherry-pick](/git/commands/git-cherry-pick)
- [git config](/git/commands/git-config)
- [git blame](/git/commands/git-blame)

### FAQs

- [How do I delete a branch in Git?](/git/faqs/how-to-delete-a-branch-in-git)
- [How can I remove a large file from my commit history?](/git/faqs/removing-large-files-from-git-history)
- [How do I manage files that are in the path of a previous Git submodule?](/git/faqs/add-files-git-submodule-path)
- [How to resolve merge conflicts](/git/faqs/resolve-merge-conflicts-git)
- [How to move a subdirectory into a separate Git repository](/git/faqs/detatch-subdirectory-git-submodule)
- [How do I authenticate with GitHub when pushing commits?](/git/faqs/cache-github-credentials-pushing-commits)
- [How can I change the author of multiple Git commits?](/git/faqs/update-author-committer-multiple-git-commits)
- [How do I rename a branch in Git?](/git/faqs/rename-a-branch-in-git)
- [How do I squash multiple commits into one?](/git/faqs/squash-multiple-commits-git)
- [git reset vs git revert: The Difference (with Decision Rule)](/git/faqs/difference-git-reset-revert)
- [How do I recover a deleted branch in Git?](/git/faqs/recover-deleted-branch-git)
- [How are "git fetch" and "git pull" different?](/git/faqs/difference-between-git-fetch-and-git-pull)
- [How do I clone a specific branch in Git?](/git/faqs/clone-specific-branch-git)
- [How do I use AI to write better git commit messages?](/git/faqs/ai-git-commit-messages)
- [How do I review AI-generated code before committing?](/git/faqs/review-ai-generated-code-before-committing)
- [How do I resolve merge conflicts with AI assistance?](/git/faqs/resolve-merge-conflicts-with-ai)
- [How do I generate a changelog from my git history using AI?](/git/faqs/generate-changelog-git-ai)
- [How do I add AI-powered checks to my git pre-commit hooks?](/git/faqs/ai-pre-commit-hooks-git)
- [How can I clean up deleted branches?](/git/faqs/how-to-clean-up-deleted-branches)
- [What is a "detached HEAD" in a Git repository?](/git/faqs/what-is-git-detached-head)
- [How do I undo my last commit?](/git/faqs/undo-last-git-commit)
- [How can I edit my last commit message?](/git/faqs/edit-last-commit-message)
- [How can I revert a Git repository to a previous commit?](/git/faqs/revert-git-repository-previous-commit)
- [How do I undo the most recent local commits in Git?](/git/faqs/undo-recent-commits-git)
- [How can I make Git “forget” about a file that was tracked but is now in .gitignore?](/git/faqs/forget-tracked-files-gitignore)

