Looking for a good Git tutorial

Solarion

Honorary Master
Joined
Nov 14, 2012
Messages
18,280
#1
I've been hunting around for some extra hours work and one of my prospective clients uses GIT. Now I've only dabbled in it but it seems they pretty strict with this and wanting someone to pick up on some new programming work asap. Please could one of you suggest something that starts from basic to advanced. I want to be able to show them something promising by Tuesday next week so on a deadline here!

Edit: Not the command line version. They use the UI one.

TIA
 

_kabal_

Expert Member
Joined
Oct 24, 2005
Messages
2,691
#6
using git via GUI is a complete waste of time. they are nice to bulk stage a few files in a commit, that is all.

here is the complete git masterclass :ROFL: -


Code:
git pull
git checkout -b [new-branch-name]
git checkout [branch-name]
git merge [branch-name]
git status
git diff
git add [file-name]
git commit -m "your message"
git push --set-upstream origin [branch-name]
git push
and some others which are used less frequently

Code:
git remote prune origin
git branch -d [branch-name]
git push origin :[branch-name]
 

HeftyCrab

Expert Member
Joined
Mar 26, 2009
Messages
2,192
#8
I've been hunting around for some extra hours work and one of my prospective clients uses GIT. Now I've only dabbled in it but it seems they pretty strict with this and wanting someone to pick up on some new programming work asap. Please could one of you suggest something that starts from basic to advanced. I want to be able to show them something promising by Tuesday next week so on a deadline here!

Edit: Not the command line version. They use the UI one.

TIA
You can have a look at this to assist:

https://www.sourcetreeapp.com

Not perfect but it does the job.
 

ekske1

Executive Member
Joined
Apr 22, 2017
Messages
5,073
#10
using git via GUI is a complete waste of time. they are nice to bulk stage a few files in a commit, that is all.

here is the complete git masterclass :ROFL: -


Code:
git pull
git checkout -b [new-branch-name]
git checkout [branch-name]
git merge [branch-name]
git status
git diff
git add [file-name]
git commit -m "your message"
git push --set-upstream origin [branch-name]
git push
and some others which are used less frequently

Code:
git remote prune origin
git branch -d [branch-name]
git push origin :[branch-name]
git gud :thumbsup:
 

Daruk

Honorary Master
Joined
Jul 18, 2008
Messages
37,776
#11
My experience with GIT, and correct me if I'm wrong, is be very careful to properly configure your excludes and make sure you don't have any production or test settings files lying around to commit. Once you've uploaded to GitHub for example, there's no going back short of recreating the repo from scratch... That history remains.
 

Genisys

Executive Member
Joined
Jan 12, 2016
Messages
9,391
#12
using git via GUI is a complete waste of time. they are nice to bulk stage a few files in a commit, that is all.

here is the complete git masterclass :ROFL: -


Code:
git pull
git checkout -b [new-branch-name]
git checkout [branch-name]
git merge [branch-name]
git status
git diff
git add [file-name]
git commit -m "your message"
git push --set-upstream origin [branch-name]
git push
and some others which are used less frequently

Code:
git remote prune origin
git branch -d [branch-name]
git push origin :[branch-name]
It depends, if you are already using an IDE with good Git integration it can't hurt to use it. Take the Intelij git integration, it works very well.
 

zippy

Executive Member
Joined
May 31, 2005
Messages
9,739
#14
SourceTree on Windows is awful. Endless lock file issues. We use SourceTree. I do all my checkout, pull, push, rebasing, merging from the command line and only use SourceTree has a viewer. No such issues on OSX. Haven’t used it on Linux, but I expect it to be as well behaved as OSX.

Don’t know about GitKraken, company is too cheap to use it. ;)
 

zippy

Executive Member
Joined
May 31, 2005
Messages
9,739
#15
My experience with GIT, and correct me if I'm wrong, is be very careful to properly configure your excludes and make sure you don't have any production or test settings files lying around to commit. Once you've uploaded to GitHub for example, there's no going back short of recreating the repo from scratch... That history remains.
This is a really good point. Once you have pushed something like a list of passwords to the remote and it’s merged into master, then you got problems.

However, if cloning an existing remote repo. The .gitignore file should already be properly setup.

As Daruk warns, when create new files, be careful what you put in them.
 

zippy

Executive Member
Joined
May 31, 2005
Messages
9,739
#16
Regarding a good tutorial, there isn’t really a single one. Atlassian has good beginners guides as already mentioned. Download the cheat sheet from that site. Git it just too big for there to a be one good tutorial.
 

Hamster

Resident Rodent
Joined
Aug 22, 2006
Messages
30,921
#17
using git via GUI is a complete waste of time. they are nice to bulk stage a few files in a commit, that is all.

here is the complete git masterclass :ROFL: -


Code:
git pull
git checkout -b [new-branch-name]
git checkout [branch-name]
git merge [branch-name]
git status
git diff
git add [file-name]
git commit -m "your message"
git push --set-upstream origin [branch-name]
git push
and some others which are used less frequently

Code:
git remote prune origin
git branch -d [branch-name]
git push origin :[branch-name]
Code:
git commit --amend
git merge --squash
 

Johnatan56

Honorary Master
Joined
Aug 23, 2013
Messages
24,543
#19
Code:
git commit --amend
git merge --squash
Tbh, why squash the commits unless it's for public repo's?
git stash is also quite useful when you don't want to commit but need to quickly fix something up in another branch.

I like doing git merges in VS Code due to the left-hand sidebar for version control:
https://code.visualstudio.com/docs/editor/versioncontrol#_git-support

Source Tree has always been quite laggy for me, plus I really only want GUI for merge conflict so that I can quickly get an overview of what's conflicting so I can quickly sort it out.


If you are using Jira: https://marketplace.atlassian.com/apps/4984/git-integration-for-jira?hosting=cloud&tab=overview and https://marketplace.visualstudio.com/items?itemName=Atlassian.atlascode
 

Hamster

Resident Rodent
Joined
Aug 22, 2006
Messages
30,921
#20
Tbh, why squash the commits unless it's for public repo's?
Keeps the tree clean. Only use it when guys are working on long running branches.

Team of right guys and that line is straight most of the time :p (although squash is not the reason for this, more like the last resort).
 
Top