Sublime Forum

Is it possible to copy a short sha from a commit


I can right click a commit from the log and copy the full sha, is it possible to copy just the first 7 chars somehow?



Go to the User directory by going to Preferences -> Browse Packages from the main menu and create a file by the name of Commit.sublime-menu. Paste the following and save the file.

		"caption": "Copy short commit hash",
		"command": "copy_to_clipboard",
		"args": {
			"text": "$short_commit"

This should now add a new menu option Copy short commit hash in the menu that appears when you right click on any commit in the Commit side bar tab.

Unfortunately, this copies the first 8 characters of the SHA1 hash & I am not sure of how to get the first 7.

1 Like


Just for a tiny improvement, it can use "caption": "Copy '$short_commit'", .



I feel this might be a tad confusing with the existing Copy 'abcdef56...' menu item, which copies the full hash to the clipboard (even though it shows an ellipsis).



Amazing, cheers folks