threads / discuss / 13570

Clean master, version tags

Subject: Clean master, version tags

## tl;dr

2 messages between May 19, 2008 and May 19, 2008.

replies: 1people: 2as markdown or json

Marcus· May 19, 2008, 02:21 UTC · lore

I created a lot of test files in the master, branch before Iearning how to use branches. How do I safely remove all entries in master. The branch should can be completely cleaned and leave no traces, so we have a fresh start.

2) Is there a tutorial on how to tag versions and use the version name
as reference?
Thanks,
Marcus
Shawn O. Pearce· May 19, 2008, 02:31 UTC · re: Marcus · lore

Re: Clean master, version tags

Marcus <prima@wordit.com> wrote:
> I created a lot of test files in the master, branch before Iearning
> how to use branches. How do I safely remove all entries in master. The
> branch should can be completely cleaned and leave no traces, so we
> have a fresh start.
A couple of ways.

You can checkout the branch, then forcibly reset both the branch and your working directory to some other revision, like say origin's master. Note this will overwrite any modified but not committed files!

  git checkout master
  git reset --hard origin/master
or delete the branch and recreate it:
  git branch -D master
  git branch --track master origin/master
or just delete the branch and don't even have a master:
  git branch -D master
 
> 2) Is there a tutorial on how to tag versions and use the version name
> as reference?
Read git-tag's manpage.  Creating a tag is as easy as:
  git tag -a tagname
then you can later go back to that version with:
  git checkout tagname

if you have that version checked out you can find out what the tag name was:

  git describe

you can also export that version as a tarball, even if you don't have it checked out:

  git archive --format=tar tagname | gzip >tagname.tar.gz

Does that help any? Tag names are treated almost like any other revision identifier (commit SHA-1, branch name, etc.) in git.

-- 
Shawn.

← back to recent threads