In Visual Studio Code, you can create new branches by opening the Quick Open palette by hitting Ctrl + P (Cmd + P on Mac), then typing the git branch command into the input bar. You also need to add the name of your new branch to the end of the command. This option only becomes available if you have a multirooted project, i.e. There are several Git repositories within a single project. Select this option if you want branch operations (such as checkout, merge, etc.) to be applied synchronously to all repositories within your project. If you like this option you can setup Visual Studio as diff and merge tool in global git configuration, so it will be available for every repository you are working with.
How is Visual Studio Code different than Visual Studio 2013 or 2015? How do I add file in gitlab using git command line? How do I enable Visual Studio 2010 toolset as valid option in Visual Studio 2013? Visual Studio for Mac is super important for increased Xamarin and.NET adoption on Mac. Most cross platform developers are either on Mac or Linux. As mentioned by someone else in the comments here, if Visual Studio could extend to Linux that would be fantastic for increased adoption of Xamarin. Visual Studio Code has integrated source control and includes Git support in-the-box. Many other source control providers are available through extensions on the VS Code Marketplace. Tip: Click on an extension tile to read the description and reviews in the Marketplace.
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:
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:
Source – zobrazí soubor zdrojového kódu.Source - Displays your source code file.
Změny – zobrazí změnu kódu mezi místním souborem a základním souborem.Changes - Displays the change in code between your local file and the base file.Můžete také porovnat různé verze souboru z různých hodnot hash:You can also compare different versions of the file from different hashes:
Viny – zobrazí uživatelské jméno uživatele přidruženého k jednotlivým oddílům kódu.Blame - Displays the username of the user associated with each section of code.
Log – zobrazí všechna potvrzení, časy, kalendářní data, zprávy a uživatele zodpovědné za daný soubor:Log - Displays all the commits, times, dates, messages, and users that are responsible for the file:
Sloučení – Tato možnost se dá použít, pokud při potvrzování práce dojde ke konfliktu sloučení.Merge - This can be used if you have a merge conflict when committing your work.Zobrazuje vizuální znázornění změn provedených vámi a dalším vývojářem, což umožňuje čistě kombinovat oddíly kódu.It shows a visual representation of the changes made by you and the other developer, allowing you to combine both sections of code cleanly.
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.
Visual Studio For Mac Os
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 committing
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.