...
To discard your changes (and accept the remote repository version):
- (2) run {{
git checkout --theirs README
}
To override the repository with your changes:
...
Git has explicit support for tagging and branching.
git tag
manipulates tagsgit branch
andgit checkout
manipulate branches
...
Tags
Create a tag:
Code Block |
---|
git tag [-a] TAGNAME |
Creates a lightweight tag (an alias for a commit object)
. Add -a
to create an annotated tag (i.e., with an associated message)
Also . It is also possible to create cryptographically signed tags
documentation
Tags
List .
To list tags:
Code Block |
---|
git tag |
Information To get information about a specific tag:
Code Block |
---|
git tag -v TAGNAME |
...
Branches
List branches:
Code Block |
---|
git branch |
Create a branch rooted at START:
Code Block |
---|
git branch BRANCHNAME [START |
...
]
|
If you omit START, the branch is rooted at your current HEAD.
git: Branches
Switch To switch to a branch:
Code Block |
---|
git checkout BRANCHNAME |
Create To create a branch rooted at START and switch to it:
Code Block |
---|
git checkout -b BRANCHNAME [START] |
For example, you want to enhance your code with some awesome experimental code. You create a new seas-workshop-dev branch and switch to it:
Code Block |
---|
$ git checkout -b seas-workshop-dev |
You make some changes, and when things are working you commit your branch:
Code Block |
---|
$ git commit -m 'made some awesome changes' -a |
And then merge it into the master branch:
Code Block |
---|
$ git checkout master |
...
$ git merge seas-workshop-dev |
...
Updating 1288ed3..33e4a4c |
...
Fast-forward |
...
version-control.rst | 2 ++ |
...
1 files changed, 2 insertions |
...
(+), 0 |
...
deletions(-) git: the index |
...
Git is not really just like Subversion (or most other version control solutions).
...