git push is used to push changes to a remote repository. git diff shows the all the changes made since the last pull operation from the remote repository. git diff is synonymously used as git patch. After getting the difference, the patch is applied through git am or git apply to another repository for updation.
So, are these two commands fundamentally same or is there any difference between git diff and git push?
First of all
$ git patch
git: 'patch' is not a git command. See 'git --help'.
Now as far as
git diff
versus
git push
NAME
git-diff
DESCRIPTION
Show changes between the working tree and the index or a tree, changes
between the index and a tree, changes between two trees, or changes
between two files on disk.
NAME
git-push
DESCRIPTION
Updates remote refs using local refs, while sending objects necessary
to complete the given refs.
git push is to push all the changes you made in the file to the repository.
this is the last step you make to add a change into your project.
Git diff is used to see all the changes made into the different files since the last commit.
it shows all the line added or removed into the project.
The basic flow goes like this.
you make some changes in the project. -> you do git add -> do git diff if you want to see what changes have been made -> you commit using git commit -> push the committed changes into the repository using git push.
If you are new to git, learn this interactive tutorial http://try.github.com/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With