Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Advanced Git - git basic, git better, git good

Advanced Git - git basic, git better, git good

devNetNoord

October 18, 2022
Tweet

More Decks by devNetNoord

Other Decks in Programming

Transcript

  1. Advanced Git Git basic, git better, git good Mart de

    Graaf Software Engineer devNetNoord 29 september 2022
  2. Git - commits C1 C2 C3 My.Cool.WebApp ┣ My.Cool.WebApp.csproj ┣

    appsettings.Development.json ┣ appsettings.json ┣ appsettings.Local.json ┣ appsettings.ServiceOverrides.json ┣ Program.cs ┗ Startup.cs My.Cool.WebApp ┣ My.Cool.WebApp.csproj ┣ appsettings.json ┣ Program.cs ┗ Startup.cs My.Cool.WebApp ┣ My.Cool.WebApp.csproj ┣ appsettings.Development.json ┣ appsettings.json ┣ Program.cs ┗ Startup.cs
  3. Git is tooling, afspraken zijn nodig Voorbeelden van teamafspraken kunnen

    zijn: • Rebase, don’t merge / Merge don’t rebase • Only developer X can do Y on branch Z • Don’t push to a red build • Squash a feature to a single commit before merge to master
  4. git status git init git commit git diff git log

    git branch git merge git rebase git checkout git push git pull git add git mv git fetch git stash git clone git reset git config https://www.linkedin.com/in/mart-de-graaf/
  5. Git case: Soo many local branches git remote prune ^^

    squased?? git branch --merged | grep -v "master" >/tmp/merged-branches && vi /tmp/merged-branches && xargs git branch -d </tmp/merged-branches https://stackoverflow.com/questions/7726949/remove-tracking-branches-no-longer-on-remote
  6. Git branch rename If you want to rename a branch

    while pointed to any branch, do: git branch -m <oldname> <newname> If you want to rename the current branch, you can do: git branch -m <newname>
  7. • git clone [email protected]:foo/bar.git • cd bar • # edit

    • git commit -a -m "foo" • git push • svn checkout svn://foo.com/bar bar • cd bar • # edit • svn commit -m "foo" • Git • SVN Git vs SVN
  8. • git show HEAD^ • git show HEAD~2 • git

    diff HEAD..HEAD^^ • git blame package.json • git log --graph --decorate –oneline • git show HEAD • git log --author=“Mart" • git commit –amend • git rebase –I • git reflog • git revert HEAD • Git log Git Log practise