शब्दकोश · प्रोग्रामिंग

Git Branch

A Git branch is a lightweight, movable pointer to a line of commits that lets you develop a feature or fix in isolation from the main code.

अपडेट: अक्टूबर 6, 2026

A Git branch is a named pointer to a commit that moves forward as you add new commits. Creating one gives you a separate line of development, so you can work on a feature or fix without touching the main branch.

Why it matters

Branches let several people work in parallel and keep unfinished work out of production. The usual flow is to branch from main, commit changes, open a pull request and merge the branch back once it is reviewed and tests pass. Git branches are cheap, since they are just a small file holding a commit ID.

Example

$ git switch -c add-search
$ git branch
* add-search
  main

The asterisk marks your current branch. Commits made now belong to add-search only; main stays unchanged until you merge.

Common mistakes

  • Letting a long-lived branch drift far from main, which leads to painful merge conflicts.
  • Committing work to main by accident because you forgot which branch was checked out.
  • Never deleting merged branches, which clutters the repository.

Get notified when this term updates

Plus occasional practical tips on uptime and monitoring, nothing else. Unsubscribe anytime.

यह पेज सामान्य जानकारी है, जिसे हमारी संपादकीय टीम ने लिखा है और दस्तावेज़ीकरण बदलने पर अपडेट किया जाता है। सर्वर और प्रदाता अलग-अलग होते हैं, इसलिए बदलाव पहले सुरक्षित तरीके से जाँचें। देखें: संपादकीय नीति और अस्वीकरण.