Answer the question
In order to leave comments, you need to log in
How to go to the latest commit in a branch?
What is the console command to update the current versions of files in a branch to the latest commit?
The documentation suggests using the git pull command - download all changes from update the files to the latest version.
But the problem is that I'm using jgit - it's a script for Solaris (there are no official packages for git), and it doesn't have such a command.
There is a fetch command - but this is only for downloading from a remote change repository.
There is a reset --hard command - but for this you need to know the hash of the last commit.
What other commands are there in git besides pull?
Answer the question
In order to leave comments, you need to log in
you can try git checkout HEAD
, or do git log
it, we will see the last commit, take the first 4 symbols of its cache - and then enter git checkout 1s24
, where 1s24 are the same cache symbols
A more universal way that allows you to go to any commit that is located in the branch later than the current one:
Display all commits in the branch, including those that were later than the current one:
And then just go to the last commit by hash:
And if it is the last one, then so (branch_name - branch name)git checkout branch_name
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question