git for Beginners, Day 1 - Windows setup

Started by ergophobe, February 22, 2016, 03:58:28 PM

Previous topic - Next topic

Rumbas

Good stuff Tom and thanks for taking the time. Once I get some sites up and running, I will pay attention.

Torben

I have been using SVN for almost 10 years. Motivated by this thread I seriously started to look into Git. For all active and new projects I'm now using Git. All major open source projects are hosted on Github, GitKraken is Awesome, SVN is now dead to me. Git rocks!

ergophobe

Quote from: Torben on April 27, 2016, 09:26:18 PM
SVN is now dead to me. Git rocks!

:-)

It's so easy to branch and merge and push and fetch and

I'm sure you've got all this already...

[new branch]
git checkout -b dev

[make changes and commit]
git add -A
git commit -m 'first changes on dev'

[6 days off. I'm on branch dev. Now what did I change again versus the live version?]
git diff live

[Whoa, that's a lot of changes. Just tell me which files actually changed?]
git diff dev master --name-only

[I'm lost. Did I make good commit messages?]
git log

[less detail please]
git log --oneline

[OK, I've got it. So live and master are in synch though right?]
git diff master live

[okay, let's merge dev into live and push this to the repo. First checkout live, pull down any changes, merge in our fix and push it to the live branch]
git checkout live
git pull origin live
git merge dev
git push origin live

*Note - some people say you should never use "git pull" which is actually a fetch and a merge. I got burned by this in a minor way recently because when the merge fails it's harder to back out of.