Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (29.3k points)

Is there a way to see what would be pushed if I did a git push command?

What I'm picturing is something like the "Files Changed" tab of Github's "pull request" feature. When I issue a pull request, I can look and see what will be pulled in if they accept my pull request: 

image

The command line is OK, but I'd prefer some sort of GUI (like the screenshot above).

2 Answers

0 votes
by (50.2k points)

To get the list of files that are pushed using:

git diff --stat --cached [remote/branch]

example:

git diff --stat --cached origin/master

To get the code difference on the files 

git diff [remote repo/branch]

To see full file paths of the files that will change, run:

git diff --numstat [remote repo/branch]

If you need to see the differences in a GUI you need to configure git for it using:

git difftool [filename]

Reference: https://git-scm.com/docs/git-difftool

0 votes
by (1.7k points)

See what you are committing to Git by using:

Viewing Commits:

1. commit history.

git log origin/main.HEAD

2. commit differences:

git diff origin/main.HEAD

Graphical Interface Tools:

GitKraken, Sourcetree, or GitHub Desktop represent the commits pending in an outgoing commit format, having all changes visualized.

1.2k questions

2.7k answers

501 comments

693 users

Browse Categories

...