Get an estimate of the last hold before stretching

After clicking git, the files that have changed since the last click are listed.

The question is how to get this list after another work on the local repo has been done.

eg.

$ git checkout feature/default2 $ git pull Updating 5420c70..b8eec49 Fast-forward application/configs/application.ini | 1 + application/modules/product/forms/Search.php | 3 ++ public/themes/default/bootstrap/buttons.less | 25 ----------- public/themes/default/css/cmspanel.css | 234 ++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------- public/themes/default/css/products.css | 57 ++++++++++++++++++++---- public/themes/default/css/style.css | 270 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------- public/themes/default/gfx/icons/menu-drop-dark.png | Bin 0 -> 160 bytes public/themes/default/gfx/icons/more.png | Bin 0 -> 120 bytes public/themes/default/layouts/scripts/footer.phtml | 26 ++++++++++- public/themes/default/layouts/scripts/gallery.phtml | 2 + public/themes/default/layouts/scripts/home.phtml | 2 + public/themes/default/layouts/scripts/layout.phtml | 2 + public/themes/default/layouts/scripts/products.phtml | 22 ++++----- public/themes/default/less/cmspanel.less | 26 +++++++++++ public/themes/default/less/nav.less | 4 +- public/themes/default/less/products.less | 61 +++++++++++++++++++++---- public/themes/default/less/style.less | 59 ++++++++++++++++++++++--- public/themes/default/less/widgets.less | 37 +++++++++++++++- public/themes/default/modules/cms/scripts/widgets/random.phtml | 6 +-- public/themes/default/modules/default/scripts/widgets/submenu.phtml | 2 +- public/themes/default/modules/product/scripts/index/view.phtml | 44 +++++++++--------- public/themes/default/modules/product/scripts/widgets/search.phtml | 16 +++++++ 22 files changed, 584 insertions(+), 315 deletions(-) create mode 100644 public/themes/default/gfx/icons/menu-drop-dark.png create mode 100644 public/themes/default/gfx/icons/more.png 

5420c70 is the state before stretching.
How to determine what 5420c70 sha?

If I'm right, ORIG_HEAD is the state before the last push (any push, not pull, which made some changes).

I need some kind of magic alias like git checkout SOME_HEAD to make git checkout 5420c70 for me.

I am trying to set up a git review alias that should distinguish all files modified since the last attraction that have not been updated.

In the base case, something like this works:

 git pull # lists some chanes file git diff --name-status ORIG_HEAD.. # diffs them 

but I'm looking for something like this:

 git pull # lists some chanes file git pull # up-to-date, no changes git diff --name-status ORIG_HEAD.. # diffs the files since the last pull which was not up-to-date 
+4
source share
4 answers

I think you can check reflog, i.e. HEAD@ {1} , for example. it's diff --name-only ..HEAD@ {1} .

git merge FETCH_HEAD , you can do git fetch , then do git log -p ..@ {upstream} to see upcoming changes, and then git merge FETCH_HEAD to make changes to your working copy.

+4
source

After looking in the reflog, I found that this is what I was looking for:

 git reflog --oneline | grep -m 1 "pull " | cut -d' ' -f1) 

This will return only one step of the previous successful click, which can be used in show , log , diff , etc.

+3
source

If I understand what you want, git pull is not the command you need, you should look at git fetch

when this is completed you can do

git diff HEAD...origin note that you need 3 points instead of the usual 2

This will give one spread of all changes. When you are happy, you can combine them in the usual way with git merge or using git cherry-pick to select only certain

0
source
 git log -n 1 --pretty=format:%H 
0
source

Source: https://habr.com/ru/post/1490243/


All Articles