[{"data":1,"prerenderedAt":1511},["Reactive",2],{"navigation":3,"goodies":204},[4,192,200],{"title":5,"_path":6,"children":7,"icon":191},"Blog","/posts",[8,11,14,17,20,23,26,29,32,35,38,41,44,47,50,53,56,59,62,65,68,71,74,77,80,83,86,89,92,95,98,101,104,107,110,113,116,119,122,125,128,131,134,137,140,143,146,149,152,155,158,161,164,167,170,173,176,179,182,185,188],{"title":9,"_path":10},"Testing your API with REST Client","/posts/testing-your-api-with-rest-client",{"title":12,"_path":13},"HTML templating in Xamarin","/posts/html-templating-in-xamarin",{"title":15,"_path":16},"Goodbye Azure Portal, Welcome Azure CLI","/posts/welcome-azure-cli",{"title":18,"_path":19},"Coming across Gitpod","/posts/gitpod",{"title":21,"_path":22},"Handle token retrieval while querying an API","/posts/delegating-handler",{"title":24,"_path":25},"Clean up your local git branches.","/posts/cleaning-git-branches",{"title":27,"_path":28},"Automate configuration of Teams Tab SSO with PowerShell.","/posts/teams-sso-powershell",{"title":30,"_path":31},"How to do a technology watch? - Part 1","/posts/technology-watch-part1",{"title":33,"_path":34},"How to do a technology watch? - Part 2","/posts/technology-watch-part2",{"title":36,"_path":37},"You almost no longer need Key Vault references for Azure Functions.","/posts/azure-functions-custom-configuration",{"title":39,"_path":40},"How to do a technology watch? - Part 3","/posts/technology-watch-part3",{"title":42,"_path":43},"Forget DevOps, the future is already here!","/posts/devops-future",{"title":45,"_path":46},"Week 9, 2021 - Tips I learned this week","/posts/w09-2021-tips-learned-this-week",{"title":48,"_path":49},"Week 12, 2021 - Tips I learned this week","/posts/w12-2021-tips-learned-this-week",{"title":51,"_path":52},"Week 14, 2021 - Tips I learned this week","/posts/w14-2021-tips-learned-this-week",{"title":54,"_path":55},"Once upon a time in .NET","/posts/once-upon-a-time-in-dotnet",{"title":57,"_path":58},"Install your applications with winget","/posts/winget-import",{"title":60,"_path":61},"Customize your applications when installing them with winget","/posts/winget-override",{"title":63,"_path":64},"Week 22, 2021 - Tips I learned this week","/posts/w22-2021-tips-learned-this-week",{"title":66,"_path":67},"How to connect to an Azure SQL Database from C# using Azure AD","/posts/sqlclient-active-directory-authent",{"title":69,"_path":70},"Producing packages for Windows Package Manager","/posts/wingetcreate",{"title":72,"_path":73},"4 tips about GitHub Actions environment variables and contexts","/posts/github-actions-var-and-context",{"title":75,"_path":76},"AzureWebJobsStorage, the secret you don't need in your Function App.","/posts/azure-functions-without-azurewebjobsstorage",{"title":78,"_path":79},"ASP.NET Core - Lost in configuration","/posts/lost-in-configuration",{"title":81,"_path":82},"Week 39, 2021 - Tips I learned this week","/posts/w39-2021-tips-learned-this-week",{"title":84,"_path":85},"Week 41, 2021 - Tips I learned this week","/posts/w41-2021-tips-learned-this-week",{"title":87,"_path":88},"Migrating and open-sourcing my blog","/posts/migrating-blog",{"title":90,"_path":91},"Week 45, 2021 - Tips I learned this week","/posts/w45-2021-tips-learned-this-week",{"title":93,"_path":94},"Organize your GitHub stars with Astral","/posts/astral",{"title":96,"_path":97},"Pulumi with an Azure Blob Storage backend","/posts/pulumi-azure-backend",{"title":99,"_path":100},"IaC Hot Reload with Pulumi Watch","/posts/pulumi-watch",{"title":102,"_path":103},"Week 2, 2022 - Tips I learned this week","/posts/w02-2022-tips-learned-this-week",{"title":105,"_path":106},"Week 3, 2022 - Tips I learned this week","/posts/w03-2022-tips-learned-this-week",{"title":108,"_path":109},"Week 5, 2022 - Tips I learned this week","/posts/w05-2022-tips-learned-this-week",{"title":111,"_path":112},"How to provision an Azure SQL Database with Active Directory authentication","/posts/sqldatabase-active-directory-authent",{"title":114,"_path":115},"Why will I choose Pulumi over Terraform for my next project?","/posts/pulumi-vs-terraform",{"title":117,"_path":118},"Week 19, 2022 - Tips I learned this week","/posts/w19-2022-tips-learned-this-week",{"title":120,"_path":121},"Week 20, 2022 - Tips I learned this week","/posts/w20-2022-tips-learned-this-week",{"title":123,"_path":124},"Keeping secrets secure when using API Clients","/posts/http-clients-secrets",{"title":126,"_path":127},"What made me want to be a developer?","/posts/be-a-developer",{"title":129,"_path":130},"What can we do when stuck with a programming problem?","/posts/get-unstuck",{"title":132,"_path":133},"How did I automate the setup of my developer Windows laptop?","/posts/automate-developer-machine",{"title":135,"_path":136},"Discussion about API clients","/posts/http-clients",{"title":138,"_path":139},"Week 46, 2022 - Tips I learned this week","/posts/w46-2022-tips-learned-this-week",{"title":141,"_path":142},"When Pulumi met Nuke: a .NET love story","/posts/when-pulumi-met-nuke",{"title":144,"_path":145},"A year of learning and sharing - Dev Retro 2022","/posts/2022-retro",{"title":147,"_path":148},"Perform Dynamic Execution of an npm Package","/posts/pnpm-dlx",{"title":150,"_path":151},"Manage multiple Node.js versions","/posts/pnpm-env",{"title":153,"_path":154},"Introducing the Vue.js CI/CD series","/posts/vuecicd-introduction",{"title":156,"_path":157},"Execute commands using your project dependencies","/posts/pnpm-exec",{"title":159,"_path":160},"Vue.js CI/CD: Continuous Integration","/posts/vuecicd-ci",{"title":162,"_path":163},"Who is using pnpm?","/posts/pnpm-who-is-using",{"title":165,"_path":166},"Create an Azure-Ready GitHub Repository using Pulumi","/posts/azure-ready-github-repository",{"title":168,"_path":169},"Deploying to Azure from Azure DevOps without secrets","/posts/ado-workload-identity-federation",{"title":171,"_path":172},"Effortlessly Configure GitHub Repositories for Azure Deployment via OIDC","/posts/scripting-azure-ready-github-repository",{"title":174,"_path":175},"Playing with the .NET 8 Web API template","/posts/playing-with-dotnet8",{"title":177,"_path":178},"Another year of sharing and learning - Dev Retro 2023","/posts/2023-retro",{"title":180,"_path":181},"Week 4, 2024 - Tips I learned this week","/posts/w04-2024-tips-learned-this-week",{"title":183,"_path":184},"Using dependency injection with Azure .NET SDK","/posts/azure-sdk-di",{"title":186,"_path":187},"Having Fun With IT Event Calendars","/posts/it-event-calendars",{"title":189,"_path":190},"Call your Azure AD B2C protected API with authenticated HTTP requests from your JetBrains IDE","/posts/http-clients-oauth2","i-heroicons-newspaper",{"title":193,"_path":194,"children":195,"icon":199},"Goodies","/goodies",[196],{"title":197,"_path":198},"My Git Cheat Sheet","/goodies/gitcheatsheet","i-heroicons-gift-solid",{"title":201,"_path":202,"icon":203},"About","/about","i-heroicons-user-circle-solid",[205],{"_path":198,"_dir":206,"_draft":207,"_partial":207,"_locale":208,"title":197,"description":209,"lead":210,"image":211,"body":213,"_type":1506,"_id":1507,"_source":1508,"_file":1509,"_extension":1510},"goodies",false,"","Another git cheat sheet like you'll find plenty of, but this one doesn't list basic commands. Instead it focuses on explaining which less-known git commands you will need depending on the situation you find yourself in.","Useful git commands",{"src":212},"/goodies/gitcheatsheet.webp",{"type":214,"children":215,"toc":1487},"root",[216,235,240,247,299,305,344,350,456,479,485,573,604,609,664,669,675,703,731,737,764,777,808,822,863,891,897,918,924,944,950,971,977,996,1009,1015,1080,1113,1119,1124,1167,1175,1181,1210,1227,1233,1336,1377,1389,1395,1481],{"type":217,"tag":218,"props":219,"children":220},"element","p",{},[221,224,233],{"type":222,"value":223},"text","You can find many nice git cheat sheets everywhere on the web, but let's just quote GitHub's ",{"type":217,"tag":225,"props":226,"children":230},"a",{"href":227,"rel":228},"https://github.github.com/training-kit/downloads/github-git-cheat-sheet.pdf",[229],"nofollow",[231],{"type":222,"value":232},"git cheat sheet",{"type":222,"value":234}," which provides you with most useful git commands. That is not my intent, I won't enumerate all basic commands everybody knows and uses everyday, but list some commands that I use less often and that I want to remind myself of, often because I can never remember their exact syntax.",{"type":217,"tag":218,"props":236,"children":237},{},[238],{"type":222,"value":239},"I tried to organize git commands by situation where you can need them and I added the link to the official documentation.",{"type":217,"tag":241,"props":242,"children":244},"h3",{"id":243},"when-you-need-to-add-a-range-of-commits-into-your-current-branch-history",[245],{"type":222,"value":246},"When you need to add a range of commits into your current branch history",{"type":217,"tag":248,"props":249,"children":250},"ul",{},[251,289],{"type":217,"tag":252,"props":253,"children":254},"li",{},[255,262],{"type":217,"tag":256,"props":257,"children":259},"code",{"className":258},[],[260],{"type":222,"value":261},"git cherry-pick ebe6952^..905e379",{"type":217,"tag":248,"props":263,"children":264},{},[265,284],{"type":217,"tag":252,"props":266,"children":267},{},[268,270,276,278],{"type":222,"value":269},"pick all the commits from commit ",{"type":217,"tag":256,"props":271,"children":273},{"className":272},[],[274],{"type":222,"value":275},"ebe6952",{"type":222,"value":277}," to commit ",{"type":217,"tag":256,"props":279,"children":281},{"className":280},[],[282],{"type":222,"value":283},"905e379",{"type":217,"tag":252,"props":285,"children":286},{},[287],{"type":222,"value":288},"add them in your current branch",{"type":217,"tag":252,"props":290,"children":291},{},[292],{"type":217,"tag":225,"props":293,"children":296},{"href":294,"rel":295},"https://git-scm.com/docs/git-cherry-pick",[229],[297],{"type":222,"value":298},"Doc",{"type":217,"tag":241,"props":300,"children":302},{"id":301},"when-you-messed-up-your-repository-with-git-commands-like-rebase-and-want-to-recover-changes-from-a-commit-not-in-your-history-anymore",[303],{"type":222,"value":304},"When you messed up your repository with git commands like rebase and want to recover changes from a commit not in your history anymore",{"type":217,"tag":248,"props":306,"children":307},{},[308,335],{"type":217,"tag":252,"props":309,"children":310},{},[311,317],{"type":217,"tag":256,"props":312,"children":314},{"className":313},[],[315],{"type":222,"value":316},"git reflog",{"type":217,"tag":248,"props":318,"children":319},{},[320,325,330],{"type":217,"tag":252,"props":321,"children":322},{},[323],{"type":222,"value":324},"gives you an history of the references of your HEAD (current active branch)",{"type":217,"tag":252,"props":326,"children":327},{},[328],{"type":222,"value":329},"allow you to see on which commit was your HEAD after each git command you did",{"type":217,"tag":252,"props":331,"children":332},{},[333],{"type":222,"value":334},"once you have the commit hash you are interested in, you can see what changes were made in this commit or even reset the branch to this commit",{"type":217,"tag":252,"props":336,"children":337},{},[338],{"type":217,"tag":225,"props":339,"children":342},{"href":340,"rel":341},"https://git-scm.com/docs/git-reflog",[229],[343],{"type":222,"value":298},{"type":217,"tag":241,"props":345,"children":347},{"id":346},"quickly-change-last-commit",[348],{"type":222,"value":349},"Quickly change last commit",{"type":217,"tag":351,"props":352,"children":356},"pre",{"className":353,"code":354,"language":355,"meta":208,"style":208},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","git add . //(to stage modifications to integrate to commit) \ngit commit --amend\n","bash",[357],{"type":217,"tag":256,"props":358,"children":359},{"__ignoreMap":208},[360,439],{"type":217,"tag":361,"props":362,"children":365},"span",{"class":363,"line":364},"line",1,[366,372,378,383,388,394,399,404,409,414,419,423,428,433],{"type":217,"tag":361,"props":367,"children":369},{"style":368},"--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B",[370],{"type":222,"value":371},"git",{"type":217,"tag":361,"props":373,"children":375},{"style":374},"--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D",[376],{"type":222,"value":377}," add",{"type":217,"tag":361,"props":379,"children":380},{"style":374},[381],{"type":222,"value":382}," .",{"type":217,"tag":361,"props":384,"children":385},{"style":374},[386],{"type":222,"value":387}," //",{"type":217,"tag":361,"props":389,"children":391},{"style":390},"--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF",[392],{"type":222,"value":393},"(",{"type":217,"tag":361,"props":395,"children":396},{"style":368},[397],{"type":222,"value":398},"to",{"type":217,"tag":361,"props":400,"children":401},{"style":374},[402],{"type":222,"value":403}," stage",{"type":217,"tag":361,"props":405,"children":406},{"style":374},[407],{"type":222,"value":408}," modifications",{"type":217,"tag":361,"props":410,"children":411},{"style":374},[412],{"type":222,"value":413}," to",{"type":217,"tag":361,"props":415,"children":416},{"style":374},[417],{"type":222,"value":418}," integrate",{"type":217,"tag":361,"props":420,"children":421},{"style":374},[422],{"type":222,"value":413},{"type":217,"tag":361,"props":424,"children":425},{"style":374},[426],{"type":222,"value":427}," commit",{"type":217,"tag":361,"props":429,"children":430},{"style":390},[431],{"type":222,"value":432},")",{"type":217,"tag":361,"props":434,"children":436},{"style":435},"--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8",[437],{"type":222,"value":438}," \n",{"type":217,"tag":361,"props":440,"children":442},{"class":363,"line":441},2,[443,447,451],{"type":217,"tag":361,"props":444,"children":445},{"style":368},[446],{"type":222,"value":371},{"type":217,"tag":361,"props":448,"children":449},{"style":374},[450],{"type":222,"value":427},{"type":217,"tag":361,"props":452,"children":453},{"style":374},[454],{"type":222,"value":455}," --amend\n",{"type":217,"tag":248,"props":457,"children":458},{},[459,470],{"type":217,"tag":252,"props":460,"children":461},{},[462,468],{"type":217,"tag":256,"props":463,"children":465},{"className":464},[],[466],{"type":222,"value":467},"git commit --amend",{"type":222,"value":469}," will open your git editor to allow you to change the commit message",{"type":217,"tag":252,"props":471,"children":472},{},[473],{"type":217,"tag":225,"props":474,"children":477},{"href":475,"rel":476},"https://git-scm.com/docs/git-commit",[229],[478],{"type":222,"value":298},{"type":217,"tag":241,"props":480,"children":482},{"id":481},"when-you-are-working-in-a-feature-branch-and-want-to-integrate-the-changes-done-by-your-colleagues-in-the-main-branch",[483],{"type":222,"value":484},"When you are working in a feature branch and want to integrate the changes done by your colleagues in the main branch",{"type":217,"tag":351,"props":486,"children":488},{"className":353,"code":487,"language":355,"meta":208,"style":208},"git checkout dev\ngit pull\ngit checkout featurebranch\ngit rebase dev\ngit push --force\n",[489],{"type":217,"tag":256,"props":490,"children":491},{"__ignoreMap":208},[492,509,521,538,555],{"type":217,"tag":361,"props":493,"children":494},{"class":363,"line":364},[495,499,504],{"type":217,"tag":361,"props":496,"children":497},{"style":368},[498],{"type":222,"value":371},{"type":217,"tag":361,"props":500,"children":501},{"style":374},[502],{"type":222,"value":503}," checkout",{"type":217,"tag":361,"props":505,"children":506},{"style":374},[507],{"type":222,"value":508}," dev\n",{"type":217,"tag":361,"props":510,"children":511},{"class":363,"line":441},[512,516],{"type":217,"tag":361,"props":513,"children":514},{"style":368},[515],{"type":222,"value":371},{"type":217,"tag":361,"props":517,"children":518},{"style":374},[519],{"type":222,"value":520}," pull\n",{"type":217,"tag":361,"props":522,"children":524},{"class":363,"line":523},3,[525,529,533],{"type":217,"tag":361,"props":526,"children":527},{"style":368},[528],{"type":222,"value":371},{"type":217,"tag":361,"props":530,"children":531},{"style":374},[532],{"type":222,"value":503},{"type":217,"tag":361,"props":534,"children":535},{"style":374},[536],{"type":222,"value":537}," featurebranch\n",{"type":217,"tag":361,"props":539,"children":541},{"class":363,"line":540},4,[542,546,551],{"type":217,"tag":361,"props":543,"children":544},{"style":368},[545],{"type":222,"value":371},{"type":217,"tag":361,"props":547,"children":548},{"style":374},[549],{"type":222,"value":550}," rebase",{"type":217,"tag":361,"props":552,"children":553},{"style":374},[554],{"type":222,"value":508},{"type":217,"tag":361,"props":556,"children":558},{"class":363,"line":557},5,[559,563,568],{"type":217,"tag":361,"props":560,"children":561},{"style":368},[562],{"type":222,"value":371},{"type":217,"tag":361,"props":564,"children":565},{"style":374},[566],{"type":222,"value":567}," push",{"type":217,"tag":361,"props":569,"children":570},{"style":374},[571],{"type":222,"value":572}," --force\n",{"type":217,"tag":248,"props":574,"children":575},{},[576,581,595],{"type":217,"tag":252,"props":577,"children":578},{},[579],{"type":222,"value":580},"This will rewrites your branch history, that is why the \"--force\" is needed (if you have already pushed your commits that have been rewritten)",{"type":217,"tag":252,"props":582,"children":583},{},[584,586,593],{"type":222,"value":585},"Check this ",{"type":217,"tag":225,"props":587,"children":590},{"href":588,"rel":589},"https://jeffkreeftmeijer.com/git-rebase/",[229],[591],{"type":222,"value":592},"post",{"type":222,"value":594}," to understand in a schema what happens when reintegrating changes from another branch",{"type":217,"tag":252,"props":596,"children":597},{},[598],{"type":217,"tag":225,"props":599,"children":602},{"href":600,"rel":601},"https://git-scm.com/docs/git-rebase",[229],[603],{"type":222,"value":298},{"type":217,"tag":218,"props":605,"children":606},{},[607],{"type":222,"value":608},"As a colleague suggested me, if you don't need your local main branch to be up-to-date, you can win a few keystrokes and some time by replacing the above commands by the following commands:",{"type":217,"tag":351,"props":610,"children":612},{"className":353,"code":611,"language":355,"meta":208,"style":208},"git fetch origin\ngit rebase origin/dev\ngit push --force\n",[613],{"type":217,"tag":256,"props":614,"children":615},{"__ignoreMap":208},[616,633,649],{"type":217,"tag":361,"props":617,"children":618},{"class":363,"line":364},[619,623,628],{"type":217,"tag":361,"props":620,"children":621},{"style":368},[622],{"type":222,"value":371},{"type":217,"tag":361,"props":624,"children":625},{"style":374},[626],{"type":222,"value":627}," fetch",{"type":217,"tag":361,"props":629,"children":630},{"style":374},[631],{"type":222,"value":632}," origin\n",{"type":217,"tag":361,"props":634,"children":635},{"class":363,"line":441},[636,640,644],{"type":217,"tag":361,"props":637,"children":638},{"style":368},[639],{"type":222,"value":371},{"type":217,"tag":361,"props":641,"children":642},{"style":374},[643],{"type":222,"value":550},{"type":217,"tag":361,"props":645,"children":646},{"style":374},[647],{"type":222,"value":648}," origin/dev\n",{"type":217,"tag":361,"props":650,"children":651},{"class":363,"line":523},[652,656,660],{"type":217,"tag":361,"props":653,"children":654},{"style":368},[655],{"type":222,"value":371},{"type":217,"tag":361,"props":657,"children":658},{"style":374},[659],{"type":222,"value":567},{"type":217,"tag":361,"props":661,"children":662},{"style":374},[663],{"type":222,"value":572},{"type":217,"tag":218,"props":665,"children":666},{},[667],{"type":222,"value":668},"It does the same thing than the previous set of commands, but just does not merge the changes of dev on your local dev branch. And as most of the time you don't need to and want to stay on your feature branch, that's easier and quicker to do it this way.",{"type":217,"tag":241,"props":670,"children":672},{"id":671},"when-you-want-to-have-a-clean-commit-history-on-your-branch-before-creating-your-pull-request",[673],{"type":222,"value":674},"When you want to have a clean commit history on your branch before creating your pull request",{"type":217,"tag":351,"props":676,"children":678},{"className":353,"code":677,"language":355,"meta":208,"style":208},"git rebase -i HEAD~3\n",[679],{"type":217,"tag":256,"props":680,"children":681},{"__ignoreMap":208},[682],{"type":217,"tag":361,"props":683,"children":684},{"class":363,"line":364},[685,689,693,698],{"type":217,"tag":361,"props":686,"children":687},{"style":368},[688],{"type":222,"value":371},{"type":217,"tag":361,"props":690,"children":691},{"style":374},[692],{"type":222,"value":550},{"type":217,"tag":361,"props":694,"children":695},{"style":374},[696],{"type":222,"value":697}," -i",{"type":217,"tag":361,"props":699,"children":700},{"style":374},[701],{"type":222,"value":702}," HEAD~3\n",{"type":217,"tag":248,"props":704,"children":705},{},[706,711,723],{"type":217,"tag":252,"props":707,"children":708},{},[709],{"type":222,"value":710},"Opens up an editor to pick, reword, edit, squash or fixup your last 3 commits",{"type":217,"tag":252,"props":712,"children":713},{},[714,715,721],{"type":222,"value":585},{"type":217,"tag":225,"props":716,"children":719},{"href":717,"rel":718},"https://delicious-insights.com/en/posts/getting-solid-at-git-rebase-vs-merge/#cleaning-up-your-local-history-before-pushing",[229],[720],{"type":222,"value":592},{"type":222,"value":722}," to deep dive into interactive rebase ... best git command ever ...",{"type":217,"tag":252,"props":724,"children":725},{},[726],{"type":217,"tag":225,"props":727,"children":729},{"href":600,"rel":728},[229],[730],{"type":222,"value":298},{"type":217,"tag":241,"props":732,"children":734},{"id":733},"when-you-want-to-stash-your-local-changes-with-a-specific-name-you-can-easily-find-later",[735],{"type":222,"value":736},"When you want to stash your local changes with a specific name you can easily find later",{"type":217,"tag":248,"props":738,"children":739},{},[740,751],{"type":217,"tag":252,"props":741,"children":742},{},[743,749],{"type":217,"tag":256,"props":744,"children":746},{"className":745},[],[747],{"type":222,"value":748},"git stash save \"myFriendlyStashName\"",{"type":222,"value":750}," will save your local changes in a stash with the name \"myFriendlyStashName\"",{"type":217,"tag":252,"props":752,"children":753},{},[754,756,762],{"type":222,"value":755},"When you list all you current stash later with ",{"type":217,"tag":256,"props":757,"children":759},{"className":758},[],[760],{"type":222,"value":761},"git stash list",{"type":222,"value":763},", you can easily find its number:",{"type":217,"tag":218,"props":765,"children":766},{},[767],{"type":217,"tag":768,"props":769,"children":776},"img",{"alt":770,"className":771,"src":774,"width":775},"List of Git stashes in the terminal",[772,773],"rounded-lg","mx-auto","/goodies/gitcheatsheet_console_1.png",600,[],{"type":217,"tag":248,"props":778,"children":779},{},[780,799],{"type":217,"tag":252,"props":781,"children":782},{},[783,785,791,793],{"type":222,"value":784},"Here we can see that the myFriendlyStashName is the first one and we can pop it with ",{"type":217,"tag":256,"props":786,"children":788},{"className":787},[],[789],{"type":222,"value":790},"git stash pop \"stash@{0}\"",{"type":222,"value":792}," or apply it with ",{"type":217,"tag":256,"props":794,"children":796},{"className":795},[],[797],{"type":222,"value":798},"git stash apply \"stash@{0}\"",{"type":217,"tag":252,"props":800,"children":801},{},[802],{"type":217,"tag":225,"props":803,"children":806},{"href":804,"rel":805},"https://git-scm.com/docs/git-stash#Documentation/git-stash",[229],[807],{"type":222,"value":298},{"type":217,"tag":241,"props":809,"children":811},{"id":810},"when-someone-did-a-git-push-force-on-the-repository-and-you-want-to-reset-your-local-repository",[812,814,820],{"type":222,"value":813},"When someone did a ",{"type":217,"tag":256,"props":815,"children":817},{"className":816},[],[818],{"type":222,"value":819},"git push --force",{"type":222,"value":821}," on the repository and you want to reset your local repository",{"type":217,"tag":351,"props":823,"children":825},{"className":353,"code":824,"language":355,"meta":208,"style":208},"git fetch\ngit reset origin/master --hard\n",[826],{"type":217,"tag":256,"props":827,"children":828},{"__ignoreMap":208},[829,841],{"type":217,"tag":361,"props":830,"children":831},{"class":363,"line":364},[832,836],{"type":217,"tag":361,"props":833,"children":834},{"style":368},[835],{"type":222,"value":371},{"type":217,"tag":361,"props":837,"children":838},{"style":374},[839],{"type":222,"value":840}," fetch\n",{"type":217,"tag":361,"props":842,"children":843},{"class":363,"line":441},[844,848,853,858],{"type":217,"tag":361,"props":845,"children":846},{"style":368},[847],{"type":222,"value":371},{"type":217,"tag":361,"props":849,"children":850},{"style":374},[851],{"type":222,"value":852}," reset",{"type":217,"tag":361,"props":854,"children":855},{"style":374},[856],{"type":222,"value":857}," origin/master",{"type":217,"tag":361,"props":859,"children":860},{"style":374},[861],{"type":222,"value":862}," --hard\n",{"type":217,"tag":248,"props":864,"children":865},{},[866,877],{"type":217,"tag":252,"props":867,"children":868},{},[869,871],{"type":222,"value":870},"All your local changes will be erased, if you want to keep them use ",{"type":217,"tag":256,"props":872,"children":874},{"className":873},[],[875],{"type":222,"value":876},"--soft",{"type":217,"tag":252,"props":878,"children":879},{},[880,882,889],{"type":222,"value":881},"See ",{"type":217,"tag":225,"props":883,"children":886},{"href":884,"rel":885},"https://stackoverflow.com/questions/9813816/git-pull-after-forced-update",[229],[887],{"type":222,"value":888},"this Stackoverflow post",{"type":222,"value":890}," for more information",{"type":217,"tag":241,"props":892,"children":894},{"id":893},"when-you-want-to-reset-a-file-to-its-previous-version",[895],{"type":222,"value":896},"When you want to reset a file to its previous version",{"type":217,"tag":248,"props":898,"children":899},{},[900,909],{"type":217,"tag":252,"props":901,"children":902},{},[903],{"type":217,"tag":256,"props":904,"children":906},{"className":905},[],[907],{"type":222,"value":908},"git reset HEAD^ filename",{"type":217,"tag":252,"props":910,"children":911},{},[912],{"type":217,"tag":225,"props":913,"children":916},{"href":914,"rel":915},"https://git-scm.com/docs/git-reset",[229],[917],{"type":222,"value":298},{"type":217,"tag":241,"props":919,"children":921},{"id":920},"when-you-want-to-remove-the-last-commit",[922],{"type":222,"value":923},"When you want to \"remove\" the last commit",{"type":217,"tag":248,"props":925,"children":926},{},[927,936],{"type":217,"tag":252,"props":928,"children":929},{},[930],{"type":217,"tag":256,"props":931,"children":933},{"className":932},[],[934],{"type":222,"value":935},"git reset --soft HEAD~1",{"type":217,"tag":252,"props":937,"children":938},{},[939],{"type":217,"tag":225,"props":940,"children":942},{"href":914,"rel":941},[229],[943],{"type":222,"value":298},{"type":217,"tag":241,"props":945,"children":947},{"id":946},"when-you-want-to-move-an-existing-branch-to-another-commit",[948],{"type":222,"value":949},"When you want to move an existing branch to another commit",{"type":217,"tag":248,"props":951,"children":952},{},[953,962],{"type":217,"tag":252,"props":954,"children":955},{},[956],{"type":217,"tag":256,"props":957,"children":959},{"className":958},[],[960],{"type":222,"value":961},"git branch -f myBranch ebe6952",{"type":217,"tag":252,"props":963,"children":964},{},[965],{"type":217,"tag":225,"props":966,"children":969},{"href":967,"rel":968},"https://git-scm.com/docs/git-branch",[229],[970],{"type":222,"value":298},{"type":217,"tag":241,"props":972,"children":974},{"id":973},"update-git-when-using-windows",[975],{"type":222,"value":976},"Update git when using Windows",{"type":217,"tag":351,"props":978,"children":980},{"className":353,"code":979,"language":355,"meta":208,"style":208},"git update-git-for-windows\n",[981],{"type":217,"tag":256,"props":982,"children":983},{"__ignoreMap":208},[984],{"type":217,"tag":361,"props":985,"children":986},{"class":363,"line":364},[987,991],{"type":217,"tag":361,"props":988,"children":989},{"style":368},[990],{"type":222,"value":371},{"type":217,"tag":361,"props":992,"children":993},{"style":374},[994],{"type":222,"value":995}," update-git-for-windows\n",{"type":217,"tag":248,"props":997,"children":998},{},[999,1004],{"type":217,"tag":252,"props":1000,"children":1001},{},[1002],{"type":222,"value":1003},"Sometimes, once Git is installed, we forget to update it",{"type":217,"tag":252,"props":1005,"children":1006},{},[1007],{"type":222,"value":1008},"Doing this command from time to time will allow you to benefit from git last version with new features and corrected issues",{"type":217,"tag":241,"props":1010,"children":1012},{"id":1011},"checkout-a-pr-when-using-azure-repos",[1013],{"type":222,"value":1014},"Checkout a PR when using Azure Repos",{"type":217,"tag":351,"props":1016,"children":1018},{"className":353,"code":1017,"language":355,"meta":208,"style":208},"git config --add remote.origin.fetch +refs/pull/*/merge:refs/remotes/origin/pr/*\ngit checkout pr/196 \n",[1019],{"type":217,"tag":256,"props":1020,"children":1021},{"__ignoreMap":208},[1022,1064],{"type":217,"tag":361,"props":1023,"children":1024},{"class":363,"line":364},[1025,1029,1034,1039,1044,1049,1054,1059],{"type":217,"tag":361,"props":1026,"children":1027},{"style":368},[1028],{"type":222,"value":371},{"type":217,"tag":361,"props":1030,"children":1031},{"style":374},[1032],{"type":222,"value":1033}," config",{"type":217,"tag":361,"props":1035,"children":1036},{"style":374},[1037],{"type":222,"value":1038}," --add",{"type":217,"tag":361,"props":1040,"children":1041},{"style":374},[1042],{"type":222,"value":1043}," remote.origin.fetch",{"type":217,"tag":361,"props":1045,"children":1046},{"style":374},[1047],{"type":222,"value":1048}," +refs/pull/",{"type":217,"tag":361,"props":1050,"children":1051},{"style":435},[1052],{"type":222,"value":1053},"*",{"type":217,"tag":361,"props":1055,"children":1056},{"style":374},[1057],{"type":222,"value":1058},"/merge:refs/remotes/origin/pr/",{"type":217,"tag":361,"props":1060,"children":1061},{"style":435},[1062],{"type":222,"value":1063},"*\n",{"type":217,"tag":361,"props":1065,"children":1066},{"class":363,"line":441},[1067,1071,1075],{"type":217,"tag":361,"props":1068,"children":1069},{"style":368},[1070],{"type":222,"value":371},{"type":217,"tag":361,"props":1072,"children":1073},{"style":374},[1074],{"type":222,"value":503},{"type":217,"tag":361,"props":1076,"children":1077},{"style":374},[1078],{"type":222,"value":1079}," pr/196\n",{"type":217,"tag":248,"props":1081,"children":1082},{},[1083,1096,1101],{"type":217,"tag":252,"props":1084,"children":1085},{},[1086,1088,1094],{"type":222,"value":1087},"You only need to do the ",{"type":217,"tag":256,"props":1089,"children":1091},{"className":1090},[],[1092],{"type":222,"value":1093},"git config",{"type":222,"value":1095}," command once and each fetch will also fetch the PR",{"type":217,"tag":252,"props":1097,"children":1098},{},[1099],{"type":222,"value":1100},"You can then directly checkout the PR number you want to review",{"type":217,"tag":252,"props":1102,"children":1103},{},[1104,1106],{"type":222,"value":1105},"If you use Visual Studio there is a much better way to review PR directly in your IDE by using the Microsoft Extension ",{"type":217,"tag":225,"props":1107,"children":1110},{"href":1108,"rel":1109},"https://marketplace.visualstudio.com/items?itemName=VSIDEVersionControlMSFT.pr4vs",[229],[1111],{"type":222,"value":1112},"Pull Requests for Visual Studio",{"type":217,"tag":241,"props":1114,"children":1116},{"id":1115},"when-you-want-to-trigger-a-ci-pipeline-you-want-to-test-without-changing-the-code",[1117],{"type":222,"value":1118},"When you want to trigger a CI pipeline you want to test without changing the code",{"type":217,"tag":218,"props":1120,"children":1121},{},[1122],{"type":222,"value":1123},"Instead of adding a space to a file just to have something to commit to trigger a pipeline you are testing, just do :",{"type":217,"tag":351,"props":1125,"children":1127},{"className":353,"code":1126,"language":355,"meta":208,"style":208},"git commit --allow-empty -m \"improve ci\"\n",[1128],{"type":217,"tag":256,"props":1129,"children":1130},{"__ignoreMap":208},[1131],{"type":217,"tag":361,"props":1132,"children":1133},{"class":363,"line":364},[1134,1138,1142,1147,1152,1157,1162],{"type":217,"tag":361,"props":1135,"children":1136},{"style":368},[1137],{"type":222,"value":371},{"type":217,"tag":361,"props":1139,"children":1140},{"style":374},[1141],{"type":222,"value":427},{"type":217,"tag":361,"props":1143,"children":1144},{"style":374},[1145],{"type":222,"value":1146}," --allow-empty",{"type":217,"tag":361,"props":1148,"children":1149},{"style":374},[1150],{"type":222,"value":1151}," -m",{"type":217,"tag":361,"props":1153,"children":1154},{"style":390},[1155],{"type":222,"value":1156}," \"",{"type":217,"tag":361,"props":1158,"children":1159},{"style":374},[1160],{"type":222,"value":1161},"improve ci",{"type":217,"tag":361,"props":1163,"children":1164},{"style":390},[1165],{"type":222,"value":1166},"\"\n",{"type":217,"tag":218,"props":1168,"children":1169},{},[1170],{"type":217,"tag":225,"props":1171,"children":1173},{"href":475,"rel":1172},[229],[1174],{"type":222,"value":298},{"type":217,"tag":241,"props":1176,"children":1178},{"id":1177},"flag-a-bash-script-as-executable-when-using-linux-or-wsl",[1179],{"type":222,"value":1180},"Flag a bash script as executable when using Linux or WSL",{"type":217,"tag":351,"props":1182,"children":1184},{"className":353,"code":1183,"language":355,"meta":208,"style":208},"git update-index --chmod=+x script.sh\n",[1185],{"type":217,"tag":256,"props":1186,"children":1187},{"__ignoreMap":208},[1188],{"type":217,"tag":361,"props":1189,"children":1190},{"class":363,"line":364},[1191,1195,1200,1205],{"type":217,"tag":361,"props":1192,"children":1193},{"style":368},[1194],{"type":222,"value":371},{"type":217,"tag":361,"props":1196,"children":1197},{"style":374},[1198],{"type":222,"value":1199}," update-index",{"type":217,"tag":361,"props":1201,"children":1202},{"style":374},[1203],{"type":222,"value":1204}," --chmod=+x",{"type":217,"tag":361,"props":1206,"children":1207},{"style":374},[1208],{"type":222,"value":1209}," script.sh\n",{"type":217,"tag":248,"props":1211,"children":1212},{},[1213,1218],{"type":217,"tag":252,"props":1214,"children":1215},{},[1216],{"type":222,"value":1217},"This command will make the script.sh file executable (can be useful when you need your CI like GitHub Actions to execute scripts in your repo)",{"type":217,"tag":252,"props":1219,"children":1220},{},[1221],{"type":217,"tag":225,"props":1222,"children":1225},{"href":1223,"rel":1224},"https://git-scm.com/docs/git-update-index",[229],[1226],{"type":222,"value":298},{"type":217,"tag":241,"props":1228,"children":1230},{"id":1229},"when-you-want-to-reorganize-you-git-repository",[1231],{"type":222,"value":1232},"When you want to reorganize you git repository",{"type":217,"tag":248,"props":1234,"children":1235},{},[1236,1274,1286],{"type":217,"tag":252,"props":1237,"children":1238},{},[1239,1241,1247,1249,1255,1257,1263,1265,1272],{"type":222,"value":1240},"Imagine you have created your code project at the root of your git repository and want to reorganize it to have a ",{"type":217,"tag":256,"props":1242,"children":1244},{"className":1243},[],[1245],{"type":222,"value":1246},"src",{"type":222,"value":1248},",",{"type":217,"tag":256,"props":1250,"children":1252},{"className":1251},[],[1253],{"type":222,"value":1254},"build",{"type":222,"value":1256},", ",{"type":217,"tag":256,"props":1258,"children":1260},{"className":1259},[],[1261],{"type":222,"value":1262},"docs",{"type":222,"value":1264}," ... folders like suggested in this ",{"type":217,"tag":225,"props":1266,"children":1269},{"href":1267,"rel":1268},"https://gist.github.com/davidfowl/ed7564297c61fe9ab814",[229],[1270],{"type":222,"value":1271},".NET project structure",{"type":222,"value":1273},".",{"type":217,"tag":252,"props":1275,"children":1276},{},[1277,1279,1284],{"type":222,"value":1278},"You will want to create an src folder and move all your existing files to this ",{"type":217,"tag":256,"props":1280,"children":1282},{"className":1281},[],[1283],{"type":222,"value":1246},{"type":222,"value":1285}," folder while keeping the files history.",{"type":217,"tag":252,"props":1287,"children":1288},{},[1289,1291,1297,1299,1305,1306,1312,1313,1319,1321,1326,1328,1334],{"type":222,"value":1290},"For this you can use the ",{"type":217,"tag":256,"props":1292,"children":1294},{"className":1293},[],[1295],{"type":222,"value":1296},"git mv",{"type":222,"value":1298}," command but you have to first remove or move your untracked files and folder (",{"type":217,"tag":256,"props":1300,"children":1302},{"className":1301},[],[1303],{"type":222,"value":1304},"csproj.user",{"type":222,"value":1256},{"type":217,"tag":256,"props":1307,"children":1309},{"className":1308},[],[1310],{"type":222,"value":1311},"bin/",{"type":222,"value":1256},{"type":217,"tag":256,"props":1314,"children":1316},{"className":1315},[],[1317],{"type":222,"value":1318},"obj/",{"type":222,"value":1320},") and to specify in the command not to move your ",{"type":217,"tag":256,"props":1322,"children":1324},{"className":1323},[],[1325],{"type":222,"value":1246},{"type":222,"value":1327}," folder (using ",{"type":217,"tag":256,"props":1329,"children":1331},{"className":1330},[],[1332],{"type":222,"value":1333},"!(src)",{"type":222,"value":1335},").",{"type":217,"tag":351,"props":1337,"children":1339},{"className":353,"code":1338,"language":355,"meta":208,"style":208},"git mv ./!(src) src/\n",[1340],{"type":217,"tag":256,"props":1341,"children":1342},{"__ignoreMap":208},[1343],{"type":217,"tag":361,"props":1344,"children":1345},{"class":363,"line":364},[1346,1350,1355,1360,1364,1368,1372],{"type":217,"tag":361,"props":1347,"children":1348},{"style":368},[1349],{"type":222,"value":371},{"type":217,"tag":361,"props":1351,"children":1352},{"style":374},[1353],{"type":222,"value":1354}," mv",{"type":217,"tag":361,"props":1356,"children":1357},{"style":374},[1358],{"type":222,"value":1359}," ./!",{"type":217,"tag":361,"props":1361,"children":1362},{"style":390},[1363],{"type":222,"value":393},{"type":217,"tag":361,"props":1365,"children":1366},{"style":368},[1367],{"type":222,"value":1246},{"type":217,"tag":361,"props":1369,"children":1370},{"style":390},[1371],{"type":222,"value":432},{"type":217,"tag":361,"props":1373,"children":1374},{"style":374},[1375],{"type":222,"value":1376}," src/\n",{"type":217,"tag":248,"props":1378,"children":1379},{},[1380],{"type":217,"tag":252,"props":1381,"children":1382},{},[1383],{"type":217,"tag":225,"props":1384,"children":1387},{"href":1385,"rel":1386},"https://git-scm.com/docs/git-mv",[229],[1388],{"type":222,"value":298},{"type":217,"tag":241,"props":1390,"children":1392},{"id":1391},"when-you-are-bored-with-writing-git-commands-in-your-terminal",[1393],{"type":222,"value":1394},"When you are bored with writing git commands in your terminal",{"type":217,"tag":248,"props":1396,"children":1397},{},[1398,1420,1432],{"type":217,"tag":252,"props":1399,"children":1400},{},[1401,1403],{"type":222,"value":1402},"If you are used to vs code and like it, if you are using vs code to write your code, or if you just want something more powerful than Visual Studio git integration :",{"type":217,"tag":248,"props":1404,"children":1405},{},[1406],{"type":217,"tag":252,"props":1407,"children":1408},{},[1409,1411,1418],{"type":222,"value":1410},"Install the excellent ",{"type":217,"tag":225,"props":1412,"children":1415},{"href":1413,"rel":1414},"https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens",[229],[1416],{"type":222,"value":1417},"GitLens extension",{"type":222,"value":1419}," for vs code",{"type":217,"tag":252,"props":1421,"children":1422},{},[1423,1425],{"type":222,"value":1424},"If you prefer standalone git client, have a look at ",{"type":217,"tag":225,"props":1426,"children":1429},{"href":1427,"rel":1428},"https://git-fork.com/",[229],[1430],{"type":222,"value":1431},"Fork",{"type":217,"tag":252,"props":1433,"children":1434},{},[1435,1437],{"type":222,"value":1436},"Keep using git commands but enhance your terminal with tab completion and repository status in prompt by using",{"type":217,"tag":248,"props":1438,"children":1439},{},[1440,1469],{"type":217,"tag":252,"props":1441,"children":1442},{},[1443,1450,1452,1459,1461,1468],{"type":217,"tag":225,"props":1444,"children":1447},{"href":1445,"rel":1446},"https://github.com/dahlbyk/posh-git",[229],[1448],{"type":222,"value":1449},"Posh-Git",{"type":222,"value":1451}," and ",{"type":217,"tag":225,"props":1453,"children":1456},{"href":1454,"rel":1455},"https://github.com/JanDeDobbeleer/oh-my-posh",[229],[1457],{"type":222,"value":1458},"Oh-My-Posh",{"type":222,"value":1460}," when working in PowerShell (see more in ",{"type":217,"tag":225,"props":1462,"children":1465},{"href":1463,"rel":1464},"https://www.hanselman.com/blog/HowToMakeAPrettyPromptInWindowsTerminalWithPowerlineNerdFontsCascadiaCodeWSLAndOhmyposh.aspx",[229],[1466],{"type":222,"value":1467},"Scott Hanselman blog post",{"type":222,"value":432},{"type":217,"tag":252,"props":1470,"children":1471},{},[1472,1479],{"type":217,"tag":225,"props":1473,"children":1476},{"href":1474,"rel":1475},"https://github.com/robbyrussell/oh-my-zsh",[229],[1477],{"type":222,"value":1478},"Oh my zsh",{"type":222,"value":1480}," and its git plugin  when working in Bash (Ubuntu / WSL)",{"type":217,"tag":1482,"props":1483,"children":1484},"style",{},[1485],{"type":222,"value":1486},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":208,"searchDepth":441,"depth":441,"links":1488},[1489,1490,1491,1492,1493,1494,1495,1497,1498,1499,1500,1501,1502,1503,1504,1505],{"id":243,"depth":523,"text":246},{"id":301,"depth":523,"text":304},{"id":346,"depth":523,"text":349},{"id":481,"depth":523,"text":484},{"id":671,"depth":523,"text":674},{"id":733,"depth":523,"text":736},{"id":810,"depth":523,"text":1496},"When someone did a git push --force on the repository and you want to reset your local repository",{"id":893,"depth":523,"text":896},{"id":920,"depth":523,"text":923},{"id":946,"depth":523,"text":949},{"id":973,"depth":523,"text":976},{"id":1011,"depth":523,"text":1014},{"id":1115,"depth":523,"text":1118},{"id":1177,"depth":523,"text":1180},{"id":1229,"depth":523,"text":1232},{"id":1391,"depth":523,"text":1394},"markdown","content:3.goodies:1.gitcheatsheet.md","content","3.goodies/1.gitcheatsheet.md","md",1716749595137]