0
Git & Github
workshop
Agenda
Git basics
- File status lifecycle
- Staging and committing
- Undoing things
Distributed Git & Github I
- Basic wor...
Git basics
$ git init
Git basics - file status lifecycle
$ git status
untracked unmodified modified staged
add the file
edit the file
stage the ...
Git basics - staging and committing
Stage file and track untracked files
$ git add <file name | wildcard>
Remove and stage...
Git basics - staging and commiting
$ cat .gitignore
tmp/ # ignore all files in tmp dir
logs/*.log # all files in logs dir ...
Git basics - staging and commiting
Show unstaged changes
$ git diff
Show staged changes
$ git diff --cached
Git basics - staging and commiting
Show all commits with authors, dates and
descriptions
$ git log
Show all commits with c...
Git basics - undoing things
Change last commit
$ git commit --amend
Unstage changes in given file
$ git reset HEAD <file n...
Git basics - distributed Git & Github I
blessed repository
Git basics - distributed Git & Github I
blessed repository
developer
public
developer
public
developer
public
fork
fork
fo...
Git basics - distributed Git & Github I
blessed repository
developer
public
developer
public
developer
public
developer
pr...
Git basics - distributed Git & Github I
blessed repository
developer
public
developer
public
developer
public
developer
pr...
Git basics - distributed Git & Github I
blessed repository
developer
public
developer
public
developer
public
developer
pr...
Git basics - distributed Git & Github I
blessed repository
developer
public
developer
public
developer
public
developer
pr...
Git basics - distributed Git & Github I
$ git clone <url>
$ git push <remote> <branch>
Git basics - Creating and switching
branches
Create branch
$ git branch <name>
Activate branch
$ git checkout <name>
Remov...
Git basics - Creating and switching
branches
Merge changes from branch <branch> to
selected branch
$ git merge <branch>
c0...
Git basics - Creating and switching
branches
Rebase changes from branch <branch> to given
branch
$ git rebase <branch>
c0
...
Upcoming SlideShare
Loading in...5
×

Brainly git basics workshop

299

Published on

Slides from workshop about git basics

Published in: Software, Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
299
On Slideshare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Brainly git basics workshop"

  1. 1. Git & Github workshop
  2. 2. Agenda Git basics - File status lifecycle - Staging and committing - Undoing things Distributed Git & Github I - Basic workflow (fork, commit, pull request) Branching - Creating and switching branches - Merging - Rebasing Distributed Git & Github II - Distributed workflow - Synchronising with upstream and resolving conflicts
  3. 3. Git basics $ git init
  4. 4. Git basics - file status lifecycle $ git status untracked unmodified modified staged add the file edit the file stage the file remove the file commit
  5. 5. Git basics - staging and committing Stage file and track untracked files $ git add <file name | wildcard> Remove and stage file removal $ git rm <file name | wildcard> Commit staged changes $ git commit -m “<message>”
  6. 6. Git basics - staging and commiting $ cat .gitignore tmp/ # ignore all files in tmp dir logs/*.log # all files in logs dir with .log *.tmp # all files with .tmp ext
  7. 7. Git basics - staging and commiting Show unstaged changes $ git diff Show staged changes $ git diff --cached
  8. 8. Git basics - staging and commiting Show all commits with authors, dates and descriptions $ git log Show all commits with complete diff $ git log -p Show all commits with additions/deletions stats $ git log --stat
  9. 9. Git basics - undoing things Change last commit $ git commit --amend Unstage changes in given file $ git reset HEAD <file name> Revert unstaged changes in given file $ git checkout -- <file name>
  10. 10. Git basics - distributed Git & Github I blessed repository
  11. 11. Git basics - distributed Git & Github I blessed repository developer public developer public developer public fork fork fork
  12. 12. Git basics - distributed Git & Github I blessed repository developer public developer public developer public developer private developer private developer private clone clone clone commit
  13. 13. Git basics - distributed Git & Github I blessed repository developer public developer public developer public developer private developer private developer private push
  14. 14. Git basics - distributed Git & Github I blessed repository developer public developer public developer public developer private developer private developer private pull request
  15. 15. Git basics - distributed Git & Github I blessed repository developer public developer public developer public developer private developer private developer private review pull request & merge
  16. 16. Git basics - distributed Git & Github I $ git clone <url> $ git push <remote> <branch>
  17. 17. Git basics - Creating and switching branches Create branch $ git branch <name> Activate branch $ git checkout <name> Remove branch $ git branch -d <name>
  18. 18. Git basics - Creating and switching branches Merge changes from branch <branch> to selected branch $ git merge <branch> c0 b1 c1 c2b2 c3 branch commit merge
  19. 19. Git basics - Creating and switching branches Rebase changes from branch <branch> to given branch $ git rebase <branch> c0 b1 c1 c2b2 branch commit c0 b1 c1 c2 b2 branch commit c1 c2 rebase
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×