Get current version of repository
I’m new to GIT, but i can’t find out how to :
- Get the version of a repository (folder offline)
- 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
conky as example : https://github.com/brndnmtthws/conky
3 Solutions collect form web for “Get current version of repository”
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
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.
You can always execute a git fetch command (which will cover both of your questions)
git fetch --all --prune
This command will update your local repository with all the latest code from the remote repository.
Once you do it you can merge code into your branch from the local repo (offline)