OpenSource For You

Branches and tags

-

By default, Git uses the branch named master, which is just like trunk in Subversion—but the concept of branches is different in Git. A branch can be a short-lived branch or long-term, according to Git concepts. rsually we use short-lived branches (called topic-branches) to develop new features; once the feature developmen­t is complete, you can merge it back to the main branch (master) and delete the topic-branch. Creating and deleting branches is never expensive in Git. It is part of the Git workflow to create and delete branches.

(YeUy EUDnFh LV UeIeUenFeG Ey D EUDnFh heDG (H(A')—D pointer to the latest commit in that branch. When you make commits to a branch, the head is updated with the latest commit. The heads of branches are listed in the directory .git/refs/heads/ : $ cat .git/refs/heads/master 46bf1f4592­a7f121438a­16a9d5e20e­16db239814

The FonWenWV oI Whe mDVWeU EUDnFh heDG fiOe UeIeU Wo Whe commit ID of the latest commit in the master branch.

Tags are very similar to branches—but the difference is that tags are immutable. Once you create a tag for a particular commit, even when you create a new commit, it will not be updated. Suppose you want to tag some particular commit as a version release, you create a tag and keep it.

vou can refer to the latest commit in the current working EUDnFh XVLng Whe VhoUWhDnG ‘H(A'’. <oX FDn DOVo UeIeUenFe parent commits from the latest current commits using HEAD~N to reference the nth older commit from a particular moment. vou can run git show HEAD to display informatio­n about the latest commit.

Newspapers in English

Newspapers from India