Is it possible to view version changes locally without pushing to a remote repository? If so, how?
- 7I recommend to get acquainted with GitBook - the step-by-step Russian-speaking guide to git. - ίίί€ί
- one@Arhad it is called "Pro Git", and GitBook is something completely different :) - D-side
4 answers
Commit history:
# Π² ΡΠ΅ΠΊΡΡΠ΅ΠΉ Π²Π΅ΡΠΊΠ΅ git log # ΠΡΠ»ΠΈ Ρ
ΠΎΡΠΈΡΠ΅ ΠΏΠΎΡΠΌΠΎΡΡΠ΅ΡΡ ΠΈΠ·ΠΌΠ΅Π½Π΅Π½ΠΈΡ Π²ΠΎ Π²ΡΠ΅Ρ
Π²Π΅ΡΠΊΠ°Ρ
Π² ΠΊΡΠ°ΡΠΈΠ²ΠΎΠΌ Π²ΠΈΠ΄Π΅: git log --oneline --graph --decorate --all What has changed in the project files between two commits, branches, tags:
# ΡΠ²Π½ΠΎ ΡΡΠ°Π²Π½ΠΈΠ²Π°Π΅ΠΌ Π΄Π²Π΅ Π²Π΅ΡΠΊΠΈ git diff master branch1 # ΠΈΠ»ΠΈ Π΄Π²Π° ΠΊΠΎΠΌΠΌΠΈΡΠ° git diff ad72b3 134gf6 # ΠΌΠΎΠΆΠ½ΠΎ ΡΡΠ°Π²Π½ΠΈΡΡ ΡΡΠΎ-ΡΠΎ Ρ ΡΠ΅ΠΊΡΡΠΈΠΌ ΠΊΠΎΠΌΠΌΠΈΡΠΎΠΌ: git diff branch1 # Π½Π°ΠΏΡΠΈΠΌΠ΅Ρ, ΡΡΠ°Π²Π½ΠΈΡΡ ΠΏΡΠ΅Π΄ΡΠ΄ΡΡΠΈΠΉ ΠΊΠΎΠΌΠΌΠΈΡ: git diff HEAD^ What files have changed since the last commit:
git status -s What has changed in these files since the last commit:
git diff # ΠΌΠΎΠΆΠ½ΠΎ ΡΠΊΠ°Π·Π°ΡΡ ΠΊΠΎΠ½ΠΊΡΠ΅ΡΠ½ΡΠΉ ΡΠ°ΠΉΠ»: git diff filename - You can specify a remote branch:
git diff origin/master master. This will allow you to see directly the changes that will be flooded afterpush- vp_arth - @vp_arth yes, if you look after the
fetch. ) - Nick Volynkin β¦
Good day!
git status Shows the current status (changes in the index, changes not in the index, how many commits you have not made).
git log Displays a list of commits for the branch in which you are located. (There will be commit numbers, their names, author, commit date, etc.)
git branch Will show you which branches you have in the repository and which one you are now
git diff <Π½Π°Π·Π²Π°Π½ΠΈΠ΅ ΡΠ°ΠΉΠ»Π°> Shows unindexed file changes.
I think, for starters, you will be enough)
- And how exactly to change the code? For example, it was before commit-public String MyWord () {String word = "HELLO"; return word;} and after-public String MyWord () {String word = "HELLO2"; return word;} - precisely the flashing or hint that this and that has changed! - GoodRA
- between two commits - GoodRA
The git log -p command in bash directly highlights the red and green changes.
- 3Essentially the same
git diff- vp_arth
There are already a lot of answers, but I'll add it myself. View commits with a list of changed files:
git log --stat Sometimes you need to see which commits belong to the current branch. In the gita, this obviously cannot be done, but can be compared with the current branch.
git cherry -v master What changes have been made in the commit can also be seen this way:
git show 99452d955bdb57e7e4f2b09f8ce2fbb6cd56377a git log --statis good. - Nick Volynkin β¦- once he rescued me quite often) - Kostiantyn Okhotnyk