Home > Mobile >  Git, GitHub: How to find the exact version I cloned some time ago?
Git, GitHub: How to find the exact version I cloned some time ago?

Time:09-16

Some time ago, I joined a new company and they cloned their repo on my laptop and set me up (some files needed to be changed in order for me to be able to build). Now, I need to clone this repo again and I need to set up again. Since I committed some stuff from my first repo, I thought I'd be able to compare commits on github and see what was changed in order to fix the repo... However, the changes must not be tracked, as all I can see is specific stuff that is unrelated.

So, I thought I would compare (file system comparison, not git tracked file comparison) a newly cloned repo (without the fixes) to my old but fixed repo - however, too much has changed and I am not sure where to start...

So, if I can get the repo the same way I got it just before they fixed it... And compared that to the old and fixed repo, the number of changed files will be small enough for me to find where things need to be patched up.

So, is it possible to ask github (or git) something like:
"What version of master did this local repo start from (which commit did it clone?)"
OR:
"The first commit on this branch, over which version of master did you apply it?"

Any other idea that helps will be appreciated...

CodePudding user response:

You have an old version of master with some changes on top of it. Let's say you committed 10 changes on top of the old master.

  1. If you want to know what version of master you worked on, you can do a git log (with annotations, which is now the default), and git will let you know where you diverge from the master (I guess this one only works if the local origin/master is not yet updated).

  2. If you want to apply the changes you did to the real master locally, checkout to a new branch e.g. updated-old-master. Then rebase this branch onto the new master: git pull --rebase origin master. As the changes are old, it might cause in conflicts.

  3. In any case, you can do a git log and see the commits you did and use their commit hashes to look into them on GitHub.

  • Related