âšī¸ Skipped - page is already crawled
| Filter | Status | Condition | Details |
|---|---|---|---|
| HTTP status | PASS | download_http_code = 200 | HTTP 200 |
| Age cutoff | PASS | download_stamp > now() - 6 MONTH | 0.9 months ago |
| History drop | PASS | isNull(history_drop_reason) | No drop reason |
| Spam/ban | PASS | fh_dont_index != 1 AND ml_spam_score = 0 | ml_spam_score=0 |
| Canonical | PASS | meta_canonical IS NULL OR = '' OR = src_unparsed | Not set |
| Property | Value |
|---|---|
| URL | https://www.geeksforgeeks.org/git/how-to-move-branch-pointer-to-different-commit-without-checkout/ |
| Last Crawled | 2026-03-16 14:46:55 (25 days ago) |
| First Indexed | 2025-07-01 05:04:42 (9 months ago) |
| HTTP Status Code | 200 |
| Meta Title | How To Move Branch Pointer To Different Commit Without Checkout? - GeeksforGeeks |
| Meta Description | Your All-in-One Learning Portal: GeeksforGeeks is a comprehensive educational platform that empowers learners across domains-spanning computer science and programming, school education, upskilling, commerce, software tools, competitive exams, and more., Your All-in-One Learning Portal. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions. |
| Meta Canonical | null |
| Boilerpipe Text | null |
| Markdown | [](https://www.geeksforgeeks.org/)
- Courses
- Tutorials
- Interview Prep
- [Git Tutorial](https://www.geeksforgeeks.org/git/git-tutorial/)
- [Interview Questions](https://www.geeksforgeeks.org/git/git-interview-questions-and-answers/)
- [Exercises](https://www.geeksforgeeks.org/git/git-exercise/)
- [Cheat Sheet](https://www.geeksforgeeks.org/git/git-cheat-sheet/)
- [Bash](https://www.geeksforgeeks.org/git/working-on-git-bash/)
- [GitHub](https://www.geeksforgeeks.org/git/introduction-to-github/)
- [Branch](https://www.geeksforgeeks.org/git/introduction-to-git-branch/)
- [Merge](https://www.geeksforgeeks.org/git/git-merge-and-merge-conflict/)
- [WorkFlow](https://www.geeksforgeeks.org/git/git-workflow-etiquettes/)
- [Hooks](https://www.geeksforgeeks.org/git/git-hooks/)
- [LFS](https://www.geeksforgeeks.org/git/git-lfs-large-file-storage/)
- [Rebase](https://www.geeksforgeeks.org/git/rebasing-of-branches-in-git/)
# How To Move Branch Pointer To Different Commit Without Checkout?
Last Updated : 25 Jul, 2024
Git pros frequently utilize this strong approach to rebase branches, correct errors, and modify branch histories: shifting the branch pointer to a different commit without checking out. With this approach, you can modify the commit that a branch points to without affecting the status of your working directory. When you need to make corrections to the branch history without disrupting your ongoing work, this might be really helpful.
Table of Content
- [Approach 1: Using 'git branch -f' Command:](https://www.geeksforgeeks.org/git/how-to-move-branch-pointer-to-different-commit-without-checkout/#approach-1-using-git-branch-f-command)
- [Approach 2: Using git update-ref Command](https://www.geeksforgeeks.org/git/how-to-move-branch-pointer-to-different-commit-without-checkout/#approach-2-using-git-updateref-command)
## Approach 1: Using '****git branch -f'**** Command:
This is the most simple way to move a branch pointer. The git branch -f command forcefully updates the branch to point to a new commit.
- Identify the target commit hash to which you want to move the branch pointer.
- Execute the command:
```
git branch -f <branch-name> <commit-hash>
```
### Example:
To move the branch feature to commit 1e50717, run:
```
git branch -f feature 1e50717
```

Using 'git branch -f' Command
## Approach 2: Using git update-ref Command
The git update-ref command updates the reference of a branch directly. This method is slightly more low-level than using git branch -f.
- Identify the target commit hash.
- Execute the command:
```
git update-ref refs/heads/<branch-name> <commit-hash>
```
### Example:
To move the branch feature to commit 1e50717, run:
```
git update-ref refs/heads/abcBranch 069b95e
```
Output:

Using git update-ref Command
Comment
Article Tags:
Article Tags:
[Web Technologies](https://www.geeksforgeeks.org/category/web-technologies/)
[Git](https://www.geeksforgeeks.org/category/git/)
### Explore
[](https://www.geeksforgeeks.org/)

Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)

Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
[](https://geeksforgeeksapp.page.link/gfg-app)[](https://geeksforgeeksapp.page.link/gfg-app)
- Company
- [About Us](https://www.geeksforgeeks.org/about/)
- [Legal](https://www.geeksforgeeks.org/legal/)
- [Privacy Policy](https://www.geeksforgeeks.org/legal/privacy-policy/)
- [Contact Us](https://www.geeksforgeeks.org/about/contact-us/)
- [Advertise with us](https://www.geeksforgeeks.org/advertise-with-us/)
- [GFG Corporate Solution](https://www.geeksforgeeks.org/gfg-corporate-solution/)
- [Campus Training Program](https://www.geeksforgeeks.org/campus-training-program/)
- Explore
- [POTD](https://www.geeksforgeeks.org/problem-of-the-day)
- [Job-A-Thon](https://practice.geeksforgeeks.org/events/rec/job-a-thon/)
- [Blogs](https://www.geeksforgeeks.org/category/blogs/?type=recent)
- [Nation Skill Up](https://www.geeksforgeeks.org/nation-skill-up/)
- Tutorials
- [Programming Languages](https://www.geeksforgeeks.org/computer-science-fundamentals/programming-language-tutorials/)
- [DSA](https://www.geeksforgeeks.org/dsa/dsa-tutorial-learn-data-structures-and-algorithms/)
- [Web Technology](https://www.geeksforgeeks.org/web-tech/web-technology/)
- [AI, ML & Data Science](https://www.geeksforgeeks.org/machine-learning/ai-ml-and-data-science-tutorial-learn-ai-ml-and-data-science/)
- [DevOps](https://www.geeksforgeeks.org/devops/devops-tutorial/)
- [CS Core Subjects](https://www.geeksforgeeks.org/gate/gate-exam-tutorial/)
- [Interview Preparation](https://www.geeksforgeeks.org/aptitude/interview-corner/)
- [Software and Tools](https://www.geeksforgeeks.org/websites-apps/software-and-tools-a-to-z-list/)
- Courses
- [ML and Data Science](https://www.geeksforgeeks.org/courses/category/machine-learning-data-science)
- [DSA and Placements](https://www.geeksforgeeks.org/courses/category/dsa-placements)
- [Web Development](https://www.geeksforgeeks.org/courses/category/development-testing)
- [Programming Languages](https://www.geeksforgeeks.org/courses/category/programming-languages)
- [DevOps & Cloud](https://www.geeksforgeeks.org/courses/category/cloud-devops)
- [GATE](https://www.geeksforgeeks.org/courses/category/gate)
- [Trending Technologies](https://www.geeksforgeeks.org/courses/category/trending-technologies/)
- Videos
- [DSA](https://www.geeksforgeeks.org/videos/category/sde-sheet/)
- [Python](https://www.geeksforgeeks.org/videos/category/python/)
- [Java](https://www.geeksforgeeks.org/videos/category/java-w6y5f4/)
- [C++](https://www.geeksforgeeks.org/videos/category/c/)
- [Web Development](https://www.geeksforgeeks.org/videos/category/web-development/)
- [Data Science](https://www.geeksforgeeks.org/videos/category/data-science/)
- [CS Subjects](https://www.geeksforgeeks.org/videos/category/cs-subjects/)
- Preparation Corner
- [Interview Corner](https://www.geeksforgeeks.org/interview-prep/interview-corner/)
- [Aptitude](https://www.geeksforgeeks.org/aptitude/aptitude-questions-and-answers/)
- [Puzzles](https://www.geeksforgeeks.org/aptitude/puzzles/)
- [GfG 160](https://www.geeksforgeeks.org/courses/gfg-160-series)
- [System Design](https://www.geeksforgeeks.org/system-design/system-design-tutorial/)
[@GeeksforGeeks, Sanchhaya Education Private Limited](https://www.geeksforgeeks.org/), [All rights reserved](https://www.geeksforgeeks.org/copyright-information/) |
| Readable Markdown | null |
| Shard | 103 (laksa) |
| Root Hash | 12046344915360636903 |
| Unparsed URL | org,geeksforgeeks!www,/git/how-to-move-branch-pointer-to-different-commit-without-checkout/ s443 |