What is the difference between tags and branches
Tags are ref's that point to specific points in the git history. Tagging is usually used to capture a point in history that's used for a marked version release i. A tag is sort of a branch that does not change. Unlike branches, tags, once being created, don't have any further history of commits. From a technical point of view:. GPG signature. A few other developers will be working on this as well, but not all developers in our group are going to care about this feature. Should I be creating a branch or a tag?
In what situations should I be using one versus the other? See also gitglossary manpage:. A "branch" is an active line of development. The most recent commit on a branch is referred to as the tip of that branch. The tip of the branch is referenced by a branch head, which moves forward as additional development is done on the branch.
A single git repository can track an arbitrary number of branches, but your working tree is associated with just one of them the "current" or "checked out" branch , and HEAD points to that branch. A ref pointing to a tag or commit object. In contrast to a head, a tag is not changed by a commit. A tag is most typically used to mark a particular point in the commit ancestry chain.
An object containing a ref pointing to another object, which can contain a message just like a commit object. It can also contain a PGP signature, in which case it is called a "signed tag object". A tag represents a version of a particular branch at a moment in time. A branch represents a separate thread of development that may run concurrently with other development efforts on the same code base.
Changes to a branch may eventually be merged back into another branch to unify them. Usually you'll tag a particular version so that you can recreate it, e. A branch is more of a strategy to provide on-going updates on a particular version of the code while continuing to do development on it.
You'll make a branch of the delivered version, continue development on the main line, but make bug fixes to the branch that represents the delivered version. Eventually, you'll merge these bug fixes back into the main line. Often you'll use both branching and tagging together.
You'll have various tags that may apply both to the main line and its branches marking particular versions those delivered to customers, for instance along each branch that you may want to recreate -- for delivery, bug diagnosis, etc. It's actually more complicated than this -- or as complicated as you want to make it -- but these examples should give you an idea of the differences. A brand new repository has only one of those called master , which automatically moves to the latest page think commit you've written.
However, you're free to create and use more bookmarks, in order to mark other points of interest in the book, so you can return to them quickly. Also, you can always move a particular bookmark to some other page of the book using git-reset , for instance ; points of interest typically vary over time. It may contain a title think annotated tags or not.
A tag is similar but different to a branch, in that it marks a point of historical interest in the book. To maintain its historical aspect, once you've shared a tag i. What you need to realize, coming from CVS, is that you no longer create directories when setting up a branch.
No more "sticky tag" which can be applied to just one file , or "branch tag". Branch and tags are two different objects in Git, and they always apply to the all repo. That structure comes from the fact CVS is a revision system and not a version system see Source control vs. Revision Control? Your question makes senses if you are used to checkout a tag, and start working in it. Which you shouldn't ; A tag is supposed to represent an immutable content, used only to access it with the guarantee to get the same content every time.
In Git, the history of revisions is a series of commits, forming a graph. A branch is one path of that graph. When your work is completed, saved committed and pushed remotely, hopefully your code will be reviewed and merged into the main development branch.
When you checkout a branch, it points to the most recent commit that you have locally. Branches are dynamic and code can be added to them. A tag points to a specific commit on any branch. You cannot add more code to a tag — it is a reference to a specific commit, kind of like a snapshot.
When would you want something like this? That's all on difference between trunk, branch and tags in Subversion or SVN. They are mostly categorized based upon there usage. Though trunk, branch and tag are quite common words in source control, and other SCM also uses these words, there behavior may be little different on other SCM, so don't forget to check SCM documentation. Other Programming articles from Javarevisited Blog. How to Swap two numbers with using third variable in Java.
Share to Twitter Share to Facebook. Labels: core java , programming , svn. July 17, at PM. Newer Post Older Post Home. Subscribe to: Post Comments Atom. Subscribe for Discounts and Updates Follow. Search This Blog. Interview Questions core java interview question data structure and algorithm 78 Coding Interview Question 75 interview questions 70 design patterns 35 SQL Interview Questions 34 object oriented programming 34 thread interview questions 30 spring interview questions 28 collections interview questions 25 database interview questions 16 servlet interview questions 15 Programming interview question 6 hibernate interview questions 6.
How to design a vending machine in Java? How HashMap works in Java? Why String is Immutable in Java? Translate This Blog. ClassNotFoundException: org. Law of Demeter in Java - Principle of least Knowle
0コメント