I'm a complete newbie to Git, not really sure what's going on. My buddy and I are working on a project together.
I fetched all the files from a remote server git fetch
, so I now have a whole bunch of files.
I edit some of them, he edits some of them, etc.
I keep doing fetch everyday, and he begins to tell me that he has modified some of the files and updated them, but these changes do not show up on my end.
I open up Git GUI in Windows, on the left side there are two panels.
One says
Unstaged Changes
- I'm taking this to mean these are things I changed which will not be updated to a local repository unless Iadd
them.The other one says
Staged Changes (Will Commit)
. Inside this window, when I click on some of the files, I do see the updates my friends have made which are NOT showing up in the files I'm editing, and I think I also see changes I've made.I add all the files with
git add .
in my directoryI press the
commit
button in Git GUI, now there are no more files in any of the two side panels, noUnstaged Changes
and noStaged Changes (Will Commit)
.I check all the files and it seems like the changes from both my end and my friend's end have been merged into one file.
I'm still not 100% sure what happened.
Question 1: Did I do this right?
Question 2: What exactly does
merge
do?
Because I keep merging with git merge origin/master
and merging doesn't seem to do a damn thing. I thought commit
just writes a record down of your current version into some hash codes, but seems like commit
is actually doing what I thought merge
does - it's merging changes.
Sorry for the long-winded question, just very confused.