Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I see what I am about to push with git?

Tags:

git

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: github example of aggregate changes

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

like image 391
cmcculloh Avatar asked Sep 03 '10 14:09

cmcculloh


People also ask

What should I do before git push?

Before you try to push code out to the repository, you should always pull all the current changes from the remote repository to your local machine. Doing so will ensure that your local copy is in sync with the remote repository.

How do you see what files are in a git commit?

To find out which files changed in a given commit, use the git log --raw command. It's the fastest and simplest way to get insight into which files a commit affects.

What is the git command to push?

The git push command is used to upload local repository content to a remote repository. Pushing is how you transfer commits from your local repository to a remote repo. It's the counterpart to git fetch , but whereas fetching imports commits to local branches, pushing exports commits to remote branches.


1 Answers

For a list of files to be pushed, run:

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

example:

git diff --stat --cached origin/master 

For the code diff of the files to be pushed, run:

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 want to see these diffs in a GUI, you will need to configure git for that. See How do I view 'git diff' output with a visual diff program?.

like image 66
Ionuț G. Stan Avatar answered Sep 22 '22 06:09

Ionuț G. Stan