Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get current version of repository

Tags:

git

I'm new to GIT, but i can't find out how to :

  1. Get the version of a repository (folder offline)
  2. Get the last version of a repository (online)

I can only compare the two, but it doesn't give me any information about the version. : git status, just tell me it's up to date.

How can i have something like this :

Your version : 1.9.0
Latest version : 1.10.1

With conky as example : https://github.com/brndnmtthws/conky

like image 365
bob dylan Avatar asked Feb 29 '16 03:02

bob dylan


People also ask

How do I know if my repository is up to date?

you can use git remote update; git status -uno to check if your local branch is up-to-date with the origin one. It only gives the local status, not checking with the remote branch. Only gives local, but git remote update ; git status -uno did the trick!

How do I find my GitHub version?

You can view the version of GitHub Enterprise Server that you're using in the footer of any page.


2 Answers

There's really no clean way to do this, since "current" version of the repository means different things to different people. It also strongly depends on whether or not tags are used.

In this scenario, if you want to rely exclusively on the tags, then you can use git tag -l to get a listing of all tags, with the most recent one created being the last entry.

If you want the most recently committed work, you'd have to look at the branches of your own volition and inspect when something was committed. In this case, it's master, so all you'd need to do is perform a log on it.

git checkout master && git log
like image 62
Makoto Avatar answered Sep 28 '22 06:09

Makoto


Git repositories don't have any kind of a monolithic "version", that they can be labeled with.

A git repository has one or more branches, with some commit at the head of each branch.

Git repositories also have a few other ancillary details, like tags.

Git is not like subversion, or CVS. There is no monolithic "version" identifier that gets incremented with every commit. Git doesn't work like that.

like image 26
Sam Varshavchik Avatar answered Sep 28 '22 06:09

Sam Varshavchik