Что такое sublime merge
Documentation FAQ
What is Git / a Git Client / Sublime Merge?
Git was originally written as a command line tool, though there are tools available to provide Git with a graphical user interface (Graphical Git Clients).
Sublime Merge is a Graphical Git Client from the creators of Sublime Text. It is powered by the same performant cross-platform GUI toolkit and syntax highlighting engine used in Sublime Text. Sublime Merge wraps around the core Git functionality, so when you’re using Sublime Merge, you’re using Git.
How do I use Sublime Merge?
Can I stage individual lines with Sublime Merge?
In fact most file-based commands in Sublime Merge also support line selections (see Making a commit)
Can I edit an existing commit?
Sublime Merge supports many commit editing operations.
Locate the commit you wish to edit in the commit graph, open the context menu, and select Edit Commit
How do I authenticate with a remote repository?
Can I diff between two commits?
Simply select the two commits you wish to diff between in the commit graph, and the diff will appear in the commit details panel.
Can I customize the keybindings in Sublime Merge?
Can I customize the theme in Sublime Merge?
Can I add custom Git commands to Sublime Merge?
Can I do X in Sublime Merge?
Sublime Merge has a lot of functionality, so your best bet is to to check the command palette or context menus. (see Using the command palette)
If you can’t find what you’re looking for, you can ask on our official forum or share feedback with the team.
Can I share feedback with the Sublime Merge team?
We love our community sharing ideas and feature requests with us.
The best way to do this is through our official issue tracker.
Documentation Getting Started with Sublime Merge
Thank you for using Sublime Merge!
Getting started with Sublime Merge is simple. In this guide you’ll be shown all the steps you need to get started.
If you haven’t already downloaded Sublime Merge, visit the download page.
Cloning an existing repository
The first step when using Git is usually cloning an existing remote repository. This process will create a copy of a remote repository on your local machine so you can begin making changes. Alternatively, if you’re starting a new project, skip to Creating a new repository.
Things you’ll need
Steps to clone a repository
Once the clone has completed, the repository will open automatically in Sublime Merge.
Creating a new repository
If you’re starting a new project, you’ll likely instead want to initialize a new Git repository instead.
Steps to create a new repository
Once you’ve done this, the new repository will open automatically in Sublime Merge.
Understanding the interface
Overview Section
Locations
The Locations column displays all branches, remotes, tags, stashes, and submodules contained in the repository.
Each item can be selected to reveal its location in the commit graph (excluding submodules). Each item also has a context menu which displays common actions.
Commits
The Commits column displays a graph of all commits contained in the repository. The commit graph is drawn as a series of commit summaries connected via coloured lines (indicating the topology of the commits).
Each commit summary contains useful information such as the commit message and author, along with any associated branches. The context menu of a commit summary also contains common actions.
When a commit summary is selected, the details of the selected commit are displayed in the Details section.
Multiple commits can be selected to perform bulk operations such as squashing or dropping commits. If multiple commits are selected, a diff of the first and last commit will also be displayed in the Details section.
Files
The Files column displays a list of all files associated with the current selection.
Details Section
The details section displays a detailed view of the selected item in the commit graph.
Pending changes
When no commits are selected in the commit graph, the current state of the working directory and index is shown in the details section. From here you can prepare and create new commits.
To create a new commit, see Creating a commit.
Commit details
When a commit is selected in the commit graph, the details of the selected commit are shown in the details section.
Commit metadata such as the commit message and author is displayed at the top of this section.
Below the commit metadata is a list of all changed files and their associated diffs (changes).
Using the command palette
The command palette is a quick way to access a vast selection of commands available to you in Sublime Merge.
For example, renaming a branch or navigating to a tag
You can open the command palette via Tools Command palette… or via Ctrl + p ( Cmd + p for MacOS).
The command palette presents a list of commands which can be filtered by typing portions of the command name you’re looking for.
You can also add you’re own custom commands to the command palette. (See customizing the command palette)
Creating a commit
Once you have made changes to any local files in your repository, your changes appear in the Pending changes section.
Modified files appear in the Working Directory section, and new files appear in the Untracked Files section. To commit new changes to the local repository, you’ll first need to stage the changes.
Staging Changes using Sublime Merge
Staging an entire file: select the Stage file button at the top of the file
Staging an entire hunk: select the Stage hunk button at the top of the file
Staging individual lines: select the individual lines you wish to stage and select Stage lines
Reviewing your changes before committing
You can review staged changes by scrolling to the Staged files section of the summary page. Alternatively, you can select each staged file tab to view the file individually.
Committing the staged changes
Begin by entering a commit message using the commit message input located at the top of the screen by default. Once you’ve entered the commit message, select the Commit button.
Commit Message Input
Fixing and editing commits
You may make a new commit, only to realise you’ve made a mistake. Maybe the commit message isn’t quite right, or you forgot to include a file in the commit.
Sublime Merge has first-class support for editing commits to handle these situations.
Editing a commit message
To edit a commits message, simply open the commit context menu and select Edit Commit Edit Commit Message…
Editing commit contents
Editing the most recent commit
To edit the most recent commit, you can use the amend functionality.
Git will now combine the staged changes with the previous commit.
Editing older commits
If you want to edit older commits, you can use the Edit Commit Contents functionality.
Locate the commit you want to edit, open the context menu, and select Edit Commit Edit Commit Contents… The selected commit will be undone, and you’ll have a chance to update the commit contents. Once you’re happy with the changes, re-commit them using the Commit button.
Select the Continue rebase button to complete the edit. If you make a mistake and want to abort the edit, select the Abort rebase button.
Note that editing older commits may produce merge conflicts which will need to be resolved. See Resolving merge conflicts.
A note about editing commits
Editing a commit makes an entirely new commit and hides the old commit (due to the way Git works). Additionally, editing a commit locally won’t update any remote commits. If the commit you are editing has already been pushed to the remote repository, proceed with caution.
Creating a branch
Creating a new branch via the command palette
Open the command palette (see Using the command palette) and select Create Branch…
Creating a new branch via the commit graph
Open the context menu of an existing commit in the commit graph and select Create branch at commit…
Creating a local branch from a remote branch
Open the locations bar, and locate the Remotes section. Right click the remote branch and select Create local branch from…
Pushing and pulling
Pushing and pulling is required to share your work with others. This is done by pushing and pulling commits to and from a remote repository.
Push and Pull Buttons
You can perform a basic pushes and pulls using the buttons located in the top-right corner of the interface. For advanced push and pull options, you can select the dropdown button located next to the main button.
Merging branches
Merge via locations bar
Merge via commit graph
Merge via command palette
Resolving merge conflicts
When merging changes to the same file, Git will try to automatically merge the changes. If it can’t do this automatically, it marks the file as unmerged and you will have to manually resolve the merge conflict.
To resolve merge conflicts, you can use the merge tool available with Sublime Merge.
Steps to resolve a merge conflict
Locate the unmerged file in the Pending changes section.
In the unmerged file header, you’ll see the Resolve button which can be selected to open the merge tool.
Merge Tool
The merge tool consists of 3 columns: Ours on the left, Merged in the middle, and Theirs on the right.
Ours and Theirs correspond to the conflicting files, while Merged corresponds to the resulting merged file. Base can also be selected to display the merge base file.
Conflicting changes are displayed with a CONFLICT marker. You can select which conflicting change to accept using the or
button located adjacent to the conflicting hunk.
Once all conflicts have been resolved, you can select Save and stage to save the merged file and stage it. Alternatively, you can select Cancel to abandon the changes.
Adding remotes
To push commits to a remote repository, you may need to add a new remote.
Adding remotes via command palette
You’ll also find Delete Remote… and Rename Remote… commands within the command palette.
Setting the upstream
The upstream branch tells Git which remote branch to associate with a local branch (and is used to indicate where to push new commits).
Setting upstream branch via command palette
Setting upstream branch via locations bar
Remote authentication
When making changes to a remote repository, it’s likely you’ll need to provide authentication.
Authenticating via HTTPS
When performing an action that requires authentication on a repository using HTTPS connections, an authentication dialog will be displayed. Enter the username and password used to authenticate with the remote repository, then select the OK button.
Note that this is only available on Linux and MacOS. For Windows users, you can use Git Credential Manager for Windows. (See https://github.com/Microsoft/Git-Credential-Manager-for-Windows)
Authenticating via SSH
For SSH authentication, Git will try to use the default ssh key stored at
/.ssh/ to authenticate. You may be asked to unlock your key, in which case you can enter the passphrase associated with the SSH key to continue.
Windows: setting up PuTTY / plink / pageant with Sublime Merge
This guide assumes you have existing SSH keys you can import into PuTTY. If not, please read this guide first.
Now that the key is saved, you can enable plink/PuTTY in Sublime Merge via the preferences.
Now that Sublime Merge is using plink, the last optional step is to start pageant and load in your credentials. This ensures you don’t have to enter your SSH credentials every time you perform a remote operation.
Что такое sublime merge
With a zippy cross-platform GUI toolkit, an unmatched syntax highlighting engine, and a custom high-performance Git reading library, Sublime Merge sets the bar for performance.
Precise and Flexible
Commit exactly what you want with line-by-line and hunk staging. Select one or more lines to split hunks into multiple changes.
Sublime Highlighting
With the power of Sublime Text syntax highlighting, you can understand exactly what’s been changed in a commit. With over 40 supported languages out of the box, and automatic loading of installed third-party syntaxes, we’ve got you covered.
From our Users
Sublime Merge is the best cross platform GUI git client that I have come across in long time. Love its simplicity. Thank you! @sublimehq
Sublime Merge, it’s literally 100 times better than anything else out there.
It’s for power users, so it takes some time to master, but it’s amazing.
Omg it’s so easy to remove a line from a commit in #SublimeMerge.
Real Git
When you’re using Sublime Merge, you’re using Git. View the exact Git commands you’re using, and seamlessly transition between the command line and Sublime Merge.
Powerful Search
Looking for a commit? Use find-as-you-type search to find the exact commit you’re looking for.
Your Git Client
Make it yours with an adaptable layout and powerful theming system.
Интегрируем Git в Sublime Text
Ускорение рабочего процесса и повышение производительности очень важны для разработчиков. Когда мы работаем — каждая секунда на счету, и время, которое мы проводим за решением повседневных задач (таких, как работа с git) в идеале можно было бы сэкономить и потратить более продуктивно. В этой статье мы рассмотрим способ ускорения работы с Git путем его интегрирования прямо в Sublime Text.
Ниже вы можете увидеть пример того, как быстро Git работает в связке с Sublime.
Требования
Git в командной строке
Обычно, когда я работаю в Sublime text и хочу сделать коммит, я открываю командную строку и печатаю следующее:
А теперь давайте сэкономим наше драгоценное время и проделаем все то же самое через Sublime text.
Git в редакторе Sublime Text
Если вы откроете окно команд (ctrl+shift+p) после установки плагина и напечатаете «git«, то вы увидите доступные команды для работы с Git.
Commit VS Quick Commit
Следует отметить, что плагин Git предоставляет 2 способа совершить коммит. Их главное отличие заключается в том, что «Quick commit» откроет маленькое окошко, в котором достаточно ввести текст коммита, а «Commit» откроет отдельный файл, в котором также будут отображаться изменения в проекте.
Ниже вы можете увидеть Quick commit и commit в действии.
Quick Commit
Commit
После редактирования текста коммита достаточно просто закрыть файл.
Add, Commit, и Push в Sublime Text
Если мне надо отправить все изменения на сервер, то весь процесс выглядит так:
ctrl + shift + p, печатаю add
ctrl + shift + p, печатаю quick, затем набраю текст коммита
ctrl + shift + p, печатаю push
Совет: если вы хотите добавить все изменения и закоммитить их за один шаг, достаточно воспользоваться командой «Quick Commit«. Она будет эквивалента команде
Заключение
Просто попробуйте поработать с git таким способом, и вы увидите, как много времени можно сэкономить. Кроме того, следует отметить, что функциональность плагина не ограничивается командами commit и push — есть также и другие команды, позволяющие, например, оперировать ветками. Я настоятельно рекомендую ознакомиться со всеми возможностями плагина, чтобы обеспечить максимально комфортную и быструю работу с Git.
Мне тут подсказали, что можно настроить горячие клавиши для всех трех команд через Key Bindings:
Sublime Merge for VSCode
Giovanni Derks
Sublime Merge for VSCode
Sublime Merge integration for Visual Studio Code
Features
This extension enables the following commands, available from the command palette when in a workspace with a Git repository:
Note: Contextual menu items for the editor are also provided and their visibility can be customised changing the extension settings (see «Configuration»).
Status Bar
The extension shows the number of unstaged / to be committed files in the status bar. Clicking on the status bar item will open Sublime Merge.
It’s possible to also show the current branch name in the status bar item using the showBranchName setting.
Requirements
Make sure that git and the smerge commands are available within your PATH.
Setting up the Sublime Merge command line tool
Configuration
Sublime Merge setup (optional)
The following example (by Rubén Robles) shows how it’s possible to configure Sublime Merge to use Visual Studio Code as the default editor for opening files:
These can be manually added to the Sublime Merge Preferences.sublime-settings file.
Known Issues / TODO
This is my first VSCode extension, therefore any constructive feedback is very welcome.
Release Notes
Special Thanks
I’ve been able to start working on this extension thanks to the personal development time kindly allowed by my current employer, Altmetric.