I want to check if I have the latest version of program. I have my program shared to bitbucket.org , and I want my c++ code to write me if I need to pull the latest version, or I already have the latest version.
相关问题
- Sorting 3 numbers without branching [closed]
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
- thread_local variables initialization
- What uses more memory in c++? An 2 ints or 2 funct
相关文章
- Class layout in C++: Why are members sometimes ord
- How to mock methods return object with deleted cop
- Which is the best way to multiply a large and spar
- C++ default constructor does not initialize pointe
- Selecting only the first few characters in a strin
- What exactly do pointers store? (C++)
- Converting glm::lookat matrix to quaternion and ba
- What is the correct way to declare and use a FILE
First, you have to fetch to get the state of the remote tracking branches. There isn't any other way to check if your branch has been updated on the remote. Many tools automatically fetch periodically (like every 10 minutes) for this purpose.
Then compare your local branch with its upstream. One way to do that with libgit2 is to use the
revwalk
functionality. If yougit_revwalk_push_ref
the upstream andgit_revwalk_hide_ref
the local branch then walk over the range, you can count how many commits behind your local branch is. Do the opposite to get the number of commits ahead.Example: