Visual Studio Code has built in Git support, but very few know how to use it on OSX with GitHub. Even in the official docs, there is only a few paragraphs on it. In this post, I’ll show you how I set it up. A1.2 Git in Visual Studio; A1.3 Git in Eclipse; A1.4 Git. A1.1 Appendix A: Git in Other Environments - Graphical Interfaces. If you read through the whole book, you’ve learned a lot about how to use Git at the command line. GitHub has created two workflow-oriented Git clients: one for Windows, and one for Mac. I am new to GIT, so far I had been using Visual Studio Online TFS for my version control and I am the only developer. When I created my last project I was kind of mislead into thinking GIT was the best option for this. Visual Studio Code の git 連携機能と git コマンドについて (2018/05/23) Git - Book 2nd Edition (2014) 日本語訳の Chapter 2. Git の基本; Chapter 3.
-->
Git je distribuovaný systém správy verzí, který umožňuje týmům současně pracovat na stejných dokumentech.Git is a distributed version control system that allows teams to work on the same documents simultaneously.To znamená, že je k dispozici centrální server, který obsahuje všechny soubory, ale v případě, že je úložiště rezervováno z tohoto centrálního zdroje, je celé úložiště naklonováno na místní počítač.This means that there is a central server that contains all the files, but when a repository is checked out from this central source, the entire repository is cloned to the local machine.
V následujících částech se dozvíte, jak se Git dá použít pro správu verzí v Visual Studio pro Mac.The sections below will explore how Git can be used for version control in Visual Studio for Mac.
Nabídka správy verzí GitGit version control menu
Následující obrázek znázorňuje možnosti poskytované Visual Studio pro Mac položkou nabídky správy verzí:The image below illustrates the options provided by Visual Studio for Mac by the Version Control menu item:
Vložení a vyžádáníPush and Pull
Doručování a přijímání je dvě z nejčastěji používaných akcí v rámci Gitu.Pushing and Pulling are two of the most commonly used actions within Git.Pokud chcete synchronizovat změny provedené jinými uživateli na vzdáleném úložišti, musíte si je vyžádat .To synchronize changes that other people have made to the remote repository, you must Pull from there.To se provádí v Visual Studio pro Mac tak, že vyberete možnost Správa verzí > aktualizace řešení.This is done in Visual Studio for Mac by selecting Version Control > Update Solution.
Po aktualizaci souborů, jejich Zkontrolování a potvrzení je musíte Odeslat do vzdáleného úložiště a umožnit tak ostatním uživatelům přístup k vašim změnám.Once you have updated your files, reviewed and committed them, you must then Push them to the remote repository to allow others to access your changes.To se provádí v Visual Studio pro Mac tím, že vyberete řízení verze > nabízených změn.This is done in Visual Studio for Mac by selecting Version Control > Push Changes.Tím se zobrazí dialogové okno pro vložení, které vám umožní zobrazit potvrzené změny a vybrat větev, do které se má vložit:This will display the Push dialog, allowing you to view the committed changes, and select the branch to push to:
Změny můžete také potvrdit a nasdílet současně pomocí dialogového okna potvrzení:You can also Commit and Push your changes at the same time, via the Commit dialog: https://cellever232.weebly.com/visual-studio-for-mac-aspnet-mvc.html.
Viny, log a MergeBlame, Log, and Merge
V dolní části okna se zobrazí pět karet, jak je znázorněno níže:At the bottom of the window, there are five tabs displayed, as illustrated below:
![]()
Tyto akce umožňují následující akce:These allow the following actions:
Přepínání větvíSwitching branches
Ve výchozím nastavení se první větev vytvořená v úložišti nazývá Hlavní větev.By default, the first branch created in a repository is known as the Master branch.Mezi hlavní větví a žádnou jinou není nic jiného, ale hlavní větev je ta, která se nejčastěji domnívá ve vývojových týmech jako 'živá' nebo 'produkční' větev.There isn't technically anything different between the master branch and any other, but the master branch is the one that is most often thought of in development teams as the 'live' or 'production' branch.
Nezávislá čára vývoje se dá vytvořit pomocí větvení mimo hlavní (nebo jakoukoli jinou větev).An independent line of development can be created by branching off Master (or any other branch, for that matter).To poskytuje novou verzi hlavní větve v určitém časovém okamžiku, což umožňuje vývoj nezávisle na tom, co je Live.This provides a new version of the master branch at a point in time, allowing for development independently of what is 'live.'Použití větví tímto způsobem se často používá k funkcím vývoje softwaru.Using branches in this way is often used for features in software development
Uživatelé můžou pro každé úložiště vytvořit libovolný počet větví, ale doporučuje se, aby po dokončení používání větve ho odstranili, aby se úložiště zachovalo.Users can create as many branches as they like for each repository, but it is recommended that once they have finished using a branch, it is deleted it to keep the repository organized.
Větve se zobrazují v Visual Studio pro Mac procházením správy verzí > správě větví a vzdálených.. :Branches are viewed in Visual Studio for Mac by browsing to Version Control > Manage Branches and Remotes..:
Přepněte na jinou větev tak, že ji vyberete v seznamu a stisknete tlačítko Přepnout na větev .Switch to another branch by selecting it in the list and pressing the Switch to Branch button.
Pokud chcete vytvořit novou větev, vyberte v dialogovém okně konfigurace úložiště Git tlačítko Nový .To create a new branch select the New button in the Git repository configuration dialog.Zadejte název nové větve:Enter the new branch name:
Můžete také nastavit vzdálenou větev na sledovací větev.You can also set a remote branch to your tracking branch.Přečtěte si další informace o sledovacích větvích v dokumentaci k Gitu.Read more about tracking branches in the Git documentation.
Zobrazit aktuální větev v Oblast řešení vedle názvu projektu:See the current branch in the Solution Pad, next to the project name:
Kontrola a potvrzováníReviewing and committingVisual Studio Git Merge Tool
Chcete-li zkontrolovat změny v souborech, použijte karty změny, viny, protokol a sloučení u každého dokumentu, který je znázorněn dříve v tomto tématu.To review changes in the files, use the Changes, Blame, Log, and Merge tabs on each document, illustrated earlier in this topic.
Zkontrolujte všechny změny v projektu, a to tak, že přejdete na řízení verze > revize řešení a potvrzení položky nabídky:Review all changes in your project by browsing to the Version Control > Review Solution and Commit menu item:
To umožňuje zobrazení všech změn v každém souboru projektu s možností vrácení, vytvoření opravy nebo potvrzení změn.This allows viewing of all the changes in each file of a project with the option to Revert, Create a Patch, or Commit.
Pokud chcete soubor potvrdit do vzdáleného úložiště, stiskněte Potvrdit, zadejte potvrzovací zprávu a potvrďte tlačítko Potvrdit:To commit a file to the remote repository, press Commit, enter a commit message, and confirm with the Commit Button:
Jakmile provedete změny, nahrajte je do vzdáleného úložiště a umožněte ostatním uživatelům, aby je viděli.Once you have committed your changes, push them to the remote repository to allow other users to see them.
Související videoRelated VideoViz také:See also
Configuring Visual Studio as your Git mergetool can help people familiar with it to resolve conflicts more easily, here I show you how. https://cellever232.weebly.com/andriod-studio-for-mac.html.
The default option for the Git mergetool is vimdiff, which although perfectly fine, will be unfamiliar to a lot of people, particularly those with a .NET development background. https://cellever232.weebly.com/how-good-is-gamemaker-studio-2-for-mac.html. For this reason I’ve changed my config to use the vsdiffmerge component of Visual Studio to do my Git diffs and merges.
First of all, you may want to change the default Git editor to be Visual Studio Code. This will be used for commit messages if you leave off the
-m command line switch when calling git commit . So to enable it, run:
The
--wait option will make the parent process wait for us to close Code before continuing.
The reason I suggest doing this first is that we will be using this editor to edit the config to add VS as a mergetool. To go ahead with this, open the global config with:
To configure the
vsdiffmerge utility as your mergetool, add the following sections to your .gitconfig (open in VS Code after the previous command):
You may need to change the cmd, depending on the location of your Visual Studio installation.
Visual Studio For Mac Git Merge Slow
So next time you perform a merge and it has conflicts, you can start to resolve the conflicts with Visual Studio by entering
git mergetool in the conflicted repository. As we specified the prompt = true option you will be prompted to resolve each conflicted file.
Hopefully this post has helped with your Git merging!
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |