Git Sourcetree Mac
SourceTree is compatible with two popular OS, so you can harness the power of Git no matter of your preferences (Windows or Mac). Working with Git properly requires extensive knowledge. Learn from detailed tutorials throwing light at merging, branching, and many more aspects. Sourcetree for mac是 Windows 和Mac OS X 下免费的SVN、Git 客户端,同时也是Mercurial和Subversion版本控制系统工具。Sourcetree for mac支持创建、克隆、提交、push、pull 和合并等操作。SourceTree拥有一个精美简洁的界面,大大简化了开发者与代码库之间的Git操作方式,这对于那些不熟悉Git命令的开发者来说非常实用。. A free Git client for Windows and Mac Sourcetree simplifies how you interact with your Git repositories so you can focus on coding. Visualize and manage your repositories through Sourcetree's simple Git GUI. GitKraken vs SourceTree: What are the differences? Developers describe GitKraken as 'Git GUI Client for Windows Mac and Linux built on Electron'. The downright luxurious Git client for Windows, Mac and Linux. Cross-platform, 100% standalone, and free. On the other hand, SourceTree is detailed as 'A free Git GUI client for Windows and macOS.
From Sourcetree, click the Branch button. Depending on whether you have a Git or Mercurial repository, you see a different popup for creating a new branch. From the New Branch or Create a new branch field, enter wish-list for the name of your branch. Click Create Branch or OK. From Sourcetree, click the Show in Finder button. The directory on.
What is Git LFS?
Git is a distributed version control system, meaning the entire history of the repository is transferred to the client during the cloning process. For projects containing large files, particularly large files that are modified regularly, this initial clone can take a huge amount of time, as every version of every file has to be downloaded by the client. Git LFS (Large File Storage) is a Git extension developed by Atlassian, GitHub, and a few other open source contributors, that reduces the impact of large files in your repository by downloading the relevant versions of them lazily. Specifically, large files are downloaded during the checkout process rather than during cloning or fetching.
Git LFS does this by replacing large files in your repository with tiny pointer files. During normal usage, you'll never see these pointer files as they are handled automatically by Git LFS:
When you add a file to your repository, Git LFS replaces its contents with a pointer, and stores the file contents in a local Git LFS cache.
When you push new commits to the server, any Git LFS files referenced by the newly pushed commits are transferred from your local Git LFS cache to the remote Git LFS store tied to your Git repository.
When you checkout a commit that contains Git LFS pointers, they are replaced with files from your local Git LFS cache, or downloaded from the remote Git LFS store.
Git LFS is seamless: in your working copy you'll only see your actual file content. This means you can use Git LFS without changing your existing Git workflow; you simply git checkout
, edit, git add
, and git commit
as normal. git clone
and git pull
operations will be significantly faster as you only download the versions of large files referenced by commits that you actually check out, rather than every version of the file that ever existed.
To use Git LFS, you will need a Git LFS aware host such as Bitbucket Cloud or Bitbucket Server. Repository users will need to have the Git LFS command-line client installed, or a Git LFS aware GUI client such as Sourcetree. Fun fact: Steve Streeting, the Atlassian developer who invented Sourcetree, is also a major contributor to the Git LFS project, so Sourcetree and Git LFS work together rather well.
What is Git LFS?
Installing Git LFS
There are three easy ways to install Git LFS:
a. Install it using your favorite package manager.
git-lfs
packages are available for Homebrew, MacPorts, dnf, and packagecloud; orb. Download and install Git LFS from the project website; or
c. Install Sourcetree, a free Git GUI client that comes bundled with Git LFS.
Once git-lfs is on your path, run git lfs install to initialize Git LFS (you can skip this step if you installed Sourcetree):
You'll only need to run
git lfs install
once. Once initialized for your system, Git LFS will bootstrap itself automatically when you clone a repository containing Git LFS content.
Creating a new Git LFS repository
To create a new Git LFS aware repository, you'll need to run git lfs install after you create the repository:
This installs a special pre-push
Git hook in your repository that will transfer Git LFS files to the server when you git push
.
Git LFS is automatically enabled for all Bitbucket Cloud repositories. For Bitbucket Server, you'll need to enable Git LFS in your repository settings:
Once Git LFS is initialized for your repository, you can specify which files to track using git lfs track
.
Cloning an existing Git LFS repository
Once Git LFS is installed, you can clone a Git LFS repository as normal using git clone
. At the end of the cloning process Git will check out the default branch (usually master
), and any Git LFS files needed to complete the checkout process will be automatically downloaded for you. For example:
There are four PNGs
in this repository being tracked by Git LFS. When running git clone, Git LFS files are downloaded one at a time as pointer files are checked out of your repository.
Speeding up clones
If you're cloning a repository with a large number of LFS files, the explicit git lfs clone
command offers far better performance:
Rather than downloading Git LFS files one at a time, the git lfs clone
command waits until the checkout is complete, and then downloads any required Git LFS files as a batch. This takes advantage of parallelized downloads, and dramatically reduces the number of HTTP requests and processes spawned (which is especially important for improving performance on Windows).
Pulling and checking out
Just like cloning, you can pull from a Git LFS repository using a normal git pull
. Any needed Git LFS files will be downloaded as part of the automatic checkout process once the pull completes:
No explicit commands are needed to retrieve Git LFS content. However, if the checkout fails for an unexpected reason, you can download any missing Git LFS content for the current commit with git lfs pull
:
Speeding up pulls
Like git lfs clone
, git lfs pull
downloads your Git LFS files as a batch. If you know a large number of files have changed since the last time you pulled, you may wish to disable the automatic Git LFS download during checkout, and then batch download your Git LFS content with an explicit git lfs pull
. This can be done by overriding your Git config with the -c
option when you invoke git pull
:
Since that's rather a lot of typing, you may wish to create a simple Git alias to perform a batched Git and Git LFS pull for you:
This will greatly improve performance when a large number of Git LFS files need to be downloaded (again, especially on Windows).
Tracking files with Git LFS
When you add a new type of large file to your repository, you'll need to tell Git LFS to track it by specifying a pattern using the git lfs track
command:
Note that the quotes around '*.ogg'
are important. Omitting them will cause the wildcard to be expanded by your shell, and individual entries will be created for each .ogg
file in your current directory:
The patterns supported by Git LFS are the same as those supported by .gitignore
, for example:
Mac Git Sourcetree 使い方
These patterns are relative to the directory in which you ran the git lfs track
command. To keep things simple, it is best to run git lfs track
from the root of your repository. Note that Git LFS does not support negative patterns like .gitignore
does.
After running git lfs track
, you'll notice a new file named .gitattributes
in the directory you ran the command from. .gitattributes
is a Git mechanism for binding special behaviors to certain file patterns. Git LFS automatically creates or updates .gitattributes
files to bind tracked file patterns to the Git LFS filter. However, you will need to commit any changes to the .gitattributes
file to your repository yourself:
For ease of maintenance, it is simplest to keep all Git LFS patterns in a single .gitattributes
file by always running git lfs track
from the root of your repository. However, you can display a list of all patterns that are currently tracked by Git LFS (and the .gitattributes
files they are defined in) by invoking git lfs track
with no arguments:
You can stop tracking a particular pattern with Git LFS by simply removing the appropriate line from your .gitattributes
file, or by running the git lfs untrack
command:
After running git lfs untrack
you will again have to commit the changes to .gitattributes
yourself.
Committing and pushing
You can commit and push as normal to a repository that contains Git LFS content. If you have committed changes to files tracked by Git LFS, you will see some additional output from git push
as the Git LFS content is transferred to the server:
If transferring the LFS files fails for some reason, the push will be aborted and you can safely try again. Like Git, Git LFS storage is content addressable: content is stored against a key which is a SHA-256 hash of the content itself. This means it is always safe to re-attempt transferring Git LFS files to the server; you can't accidentally overwrite a Git LFS file's contents with the wrong version.
Moving a Git LFS repository between hosts
To migrate a Git LFS repository from one hosting provider to another, you can use a combination of git lfs fetch
and git lfs push
with the --all option
specified.
For example, to move all Git and Git LFS repository from a remote named github
to a remote named bitbucket
😉 :
Fetching extra Git LFS history
Git LFS typically only downloads the files needed for commits that you actually checkout locally. However, you can force Git LFS to download extra content for other recently modified branches using git lfs fetch --recent
:
This is useful for batch downloading new Git LFS content while you're out at lunch, or if you're planning on reviewing work from your teammates and will not be able to download content later on due to limited internet connectivity. For example, you may wish to run git lfs fetch --recent
before jumping on a plane!
Git LFS considers any branch or tag containing a commit newer than seven days as recent. You can configure the number of days considered as recent by setting the lfs.fetchrecentrefsdays
property:
By default, git lfs fetch --recent
will only download Git LFS content for the commit at the tip of a recent branch or tag.
However you can configure Git LFS to download content for earlier commits on recent branches and tags by configuring the lfs.fetchrecentcommitsdays
property:
Use this setting with care: if you have fast moving branches, this can result in a huge amount of data being downloaded. However it can be useful if you need to review interstitial changes on a branch, cherry picking commits across branches, or rewrite history.
As discussed in Moving a Git LFS repository between hosts, you can also elect to fetch all Git LFS content for your repository with git lfs fetch --all
:
Deleting local Git LFS files
You can delete files from your local Git LFS cache with the git lfs prune
command:
This will delete any local Git LFS files that are considered old. An old file is any file not referenced by:
- the currently checked out commit
- a commit that has not yet been pushed (to origin, or whatever
lfs.pruneremotetocheck
is set to) - a recent commit
By default, a recent commit is any commit created in the last ten days. This is calculated by adding:
- the value of the
lfs.fetchrecentrefsdays
property discussed in Fetching extra Git LFS history (which defaults to seven); to - the value of the
lfs.pruneoffsetdays
property (which defaults to three)
You can configure the prune offset to retain Git LFS content for a longer period:
Unlike Git's built-in garbage collection, Git LFS content is not pruned automatically, so running git lfs prune
on a regular basis is a good idea to keep your local repository size down.
You can test out what effect a prune operation will have with git lfs prune --dry-run
:
And exactly which Git LFS objects will be pruned with git lfs prune --verbose --dry-run
:
The long hexadecimal strings output by --verbose
mode are SHA-256 hashes (also known as Object IDs, or OIDs) of the Git LFS objects to be pruned. You can use the techniques described in Finding paths or commits that reference a Git LFS object to find our more about the objects that will be pruned.
As an additional safety check, you can use the --verify-remote
option to check whether the remote Git LFS store has a copy of your Git LFS objects before they are pruned:
This makes the pruning process significantly slower, but gives you peace of mind knowing that any pruned objects are recoverable from the server. You can enable the --verify-remote
option permanently for your system by configuring the lfs.pruneverifyremotealways
property globally:
Or you can enable remote verification for just the context repository by omitting the --global
option from the command above.
Deleting remote Git LFS files from the server
The Git LFS command-line client doesn't support pruning files from the server, so how you delete them depends on your hosting provider.
In Bitbucket Cloud, you can view and delete Git LFS files via Repository Settings > Git LFS:
Note that each Git LFS file is indexed by its SHA-256 OID; the paths that reference each file are not visible via the UI. This is because there could be many different paths at many different commits that may refer to a given object, so looking them up would be a very slow process.
To determine what a given Git LFS file actually contains, you have three options:
- look at the file preview image and file type in the left hand column of the Bitbucket Git LFS UI
- download the file using the link in the right hand column of the Bitbucket Git LFS UI -search for commits referencing the Git LFS object's SHA-256 OID, as discussed in the next section
Finding paths or commits that reference a Git LFS object
If you have a Git LFS SHA-256 OID, you can determine which commits reference it with git log --all -p -S
:
This git log
incantation generates a patch (-p
) from commits on any branch (--all
) that add or remove a line (-S
) containing the specified string (a Git LFS SHA-256 OID).
The patch shows you the commit and the path to the LFS object, as well as who added it, and when it was committed. You can simply checkout the commit, and Git LFS will download the file if needed and place it in your working copy.
If you suspect that a particular Git LFS object is in your current HEAD, or on a particular branch, you can use git grep
to find the file path that references it:
You can replace HEAD
or power-ups
with any ref, commit, or tree that contains the Git LFS object.
Including/excluding Git LFS files
In some situations you may want to only download a subset of the available Git LFS content for a particular commit. For example, when configuring a CI build to run unit tests, you may only need your source code, so may want to exclude heavyweight files that aren't necessary to build your code.
Git Sourcetree Mac Download
You can exclude a pattern or subdirectory using git lfs fetch -X
(or --exclude
):
Alternatively, you may want to only include a particular pattern or subdirectory. For example, an audio engineer could fetch just ogg
and wav
files with git lfs fetch -I
(or --include
):
If you combine includes and excludes, only files that match an include pattern and do not match an exclude pattern will be fetched. For example, you can fetch everything in your Assets directory exceptgifs
with:
Excludes and includes support the same patterns as git lfs track
and .gitignore
. You can make these patterns permanent for a particular repository by setting the lfs.fetchinclude
and lfs.fetchexclude
config properties:
These settings can also be applied to every repository on your system by appending the --global
option.
Locking Git LFS files
Unfortunately, there is no easy way of resolving binary merge conflicts. With Git LFS file locking, you can lock files by extension or by file name and prevent binary files from being overwritten during a merge.
In order to take advantage of LFS' file locking feature, you first need to tell Git which type of files are lockable. In the example below, the `--lockable` flag is appended to the `git lfs track` command which both stores PSD files in LFS and marks them as lockable.
Then add the following to your .gitattributes file:
When preparing to make changes to an LFS file, you'll use the lock command in order to register the file as locked on your Git server.
Once you no longer need the file lock, you can remove it using Git LFS' unlock command.
Git LFS file locks can be overridden, similar to git push
, using a --force
flag. Do not use the --force
flag unless you’re absolutely sure you know what you’re doing.
How Git LFS works
If you're interested in learning more about clean and smudge filters, pre-push hooks, and the other interesting computer science behind Git LFS, check out this presentation from Atlassian on Git LFS at LinuxCon 2016:
Next up:
Git gc documentation
Start next tutorialGit, perhaps the best and commonly used version control system (VCS) is a free and open-source distributed VCSW that is designed to execute all sorts of projects with great speed and efficiency. It’s an easy to learn application that has a small footprint combined with a lightning performance. Today, there’s a massive deployment of Git GUI in various OSs such as iOS, Mac, Android, Windows, and Linux. This facilitates the easy integration of different features to assist users to work along with their team when they cooperate to implement projects. Git repositories are widely used in projects to manage and store code, irrespective of the size of the enterprise or project. With this application, you can easily code and provide thrilling integration features that enable you to easily work with any kind of project or alongside your teammates.
Now, developers must possess Git skills. For newbies, they usually begin with Git commands that enable them to grasp the fundamentals of Git. Whilst it’s important to learn these commands, sometimes it feels a bit boring and tedious returning to the terminal to handle primitive and fairly simple tasks such as “committing” or “pushing”. Luckily, in this article, some of the best Git tools/extensions that make these tasks simpler are discussed, thereby making your workflow easier and increasing your efficiency. Also, in the post, the fundamentals of these tools are covered. We start with Bit, a tool that tracks all the components of an application (React, Angular, Vue et al.) as individual code pieces and then makes them published on Bit.dev, which is a component of the cloud hub designed to create the availability of reusable components making them discoverable for yourself and the team. Bit is a powerful method of maximizing code reuse, speeding up the growth, and building a much more tenable codebase. All the components available on Bit.dev are cloned into various types of projects where they are easily manipulated and re-published to Bit.dev, in a different version.
Pros and cons
The Git applications provide an exemplary method of completing Git executions fast and efficiently. These tools provide the importance of visual exhibition of diffs as well as the history of the project which is actually changeling when demonstrating on Git terminal. They seamlessly and easily integrate into a workflow without the need to make a switch between the editor (text page) and terminal. While these tools and extensions offer countless advantages, there are some issues that should be known by the users. The first one is that they can only provide a specific number of features – sophisticated capabilities such as cherry-pick are executed solely on the command terminal implying that it’s paramount to learn the terminal commands. Secondly, the process of learning becomes easier when the user is well endowed with how the Git operates and the use of terminal commands –commands are easy and fast to execute as no lag occurs between the implementation and presentation of results. Lastly, the biggest disincentive to depending primarily on the applications is that their user interface (UI) is a bit inconsistent across various platforms/versions. Consequently, users are advised to only use Git applications once they have grown their competence of terminal commands. Below are some of the top Git GUI Tools and Extensions available in the market.
GitHub Desktop
An extension of GitHub and probably one of the best tools ever created by GitHub and meant for Windows. It’s a tool that enables users to interact with GitHub from their desktop computers. The application allows desktop users to work easily without relying on browsers. As a matter of fact, pundits recommend the use of GitHub Desktop as a priority when it comes to hosting projects. designed and created by GitHub, it comes with plentiful of features, particularly for Version control systems (VCS) such as:
- User-friendly interface – allowing the user to easily manage their code without typing too many commands on the command window
- Easy to track changes
- Facilitates easier creation of new repositories
- Allows addition of local repositories
- The majority of Git actions are executed from the user interface
- Allows viewing of CI statutes
- Enables syntax highlighted diffs
- Supports shell integration
GitHub Desktop is an open-source application that is compatible with Windows and Mac OS, although the Linux version hasn’t been unveiled yet it’s in progress.
SmartGit
SmartGit is a powerful, multi-platform application that comes with an equal intuitive UI on Mac OS, Windows, and Linux. The tool is widely available for free across non-profit making organizations. Users using SmartGit for commercial reasons are required to acquire a license. Unfortunately, unlike GitHub Desktop, Gitkraken, and other tools that are user-friendly, SmartGit requires you to acquire substantive knowledge/skills of Git commands. Besides, it’s a bit difficult for beginners as it comes with an overwhelming number of functionalities/buttons in its interface. Moreover, SmartGit offers a wide variety of collaboration capabilities.
Features:
- Preferences for rebasing and merging
- Support keyboard shortcuts
- Syntax colouring
- Support light and dark themes
- Allows layout of different views
SourceTree
SourceTree is a free extension designed and created by Atlassian. It’s all about simplifying user interaction with Git repositories to give them ample time to focus on coding. For beginners, SourceTree is the real thing as it allows them to simplify the distributed VCS and quickly bring everything to automatic speed. Besides, it’s a powerful tool for experts as it improves their productivity. With this tool, you can easily review changesets and cherry-pick between branches. Available for Mac OS and Windows, SourceTree is more advanced than GitHub Desktop as it features more powerful attributes than the latter.
Features include:
- Large file support (LFS): offers Git LFS enabling teams to keep track of large assets in a single place
- Supports submodules: makes it easier to manage projects, project groupings, and project dependencies.
- Enables interactive rebasing
- Enables local commit search
- Supports remote repository manager
Magit
An absolute Git porcelain, Magit is an interface to VCS Git, and often executed as a GNU Emacs package. Although Magit may not be as powerful as the other GIT tools, it enables developers to execute version control actions very well. Despite its plugin nature, the tool comes with some exemplary features like rebasing, visualization, and smooth workflow. This tool is designed for Windows, Mac OS, and Linux operating systems.
Giggle
Git Sourcetree Mac Download
Launched in 2017 as part of the Hackathon initiative, Giggle is a free-cost and user-friendly Git GUI client. Characterized by an easy to use interface – suitable for small startups and beginners, it’s easy to get accustomed to Giggle. The tool was initially designed to work on Linux OS and different renowned platforms. The front-end application enables developers to surf and view repos within its UI. This tool employs basic features found in the majority of Git GUI extensions such as commit, stag, and browse.
GitForce
Written in .NET 3.5, GitForce is a renowned source revision control tool and cross-platform and front-end application that’s often applied as a command-line tool operating on Linux, Ubuntu, and Windows OSs. It’s a simple, user-friendly, and intuitive and yet powerful application. The graphical front-end capability makes it easy-to-use and simple to understand, especially for newbie developers, to execute some basic actions and other software development operations.
Features
- Supports numerous remote repositories
- Enables easy scan for local repositories
- Comes with drag and drop functionalities
- Supports multiple workspaces with multiple sets of repositories
- Enables easy management of SSH keys and remotes
GitKraken
GitKraken is a leading tool that allows developers to increase their productivity with powerful and intuitive GUI. Compared with other Git tools, GitKraken features beautiful UI, themes, and features. Its compatibility with VCS enables it to work with different companies like GitHub, GitLab, and Bitbucket. GitKraken is regarded as one of the most preferred among Git tools and extensions.
Features include:
- Available in different packages: free (best suited for beginners and small-sized enterprises, and small teams) – can be upgraded, premium and enterprise variants ideal for experts, large companies, and large teams.
- Built-in code editor: that enables the user to kick start their project and incorporates the drag and drop functionality.
- Supports the commit-graph functionality: gives the user an instinctive experience when using GitKraken.
- Available for Mac OS, Windows, and Linux
Git Cola
Written in python, Git Cola is a powerful tool that is designed for Linux and Ubuntu operating systems. It’s a free Git client that is actually regarded as one of the most intuitive and fast VCS widely available for software development. The application features a wide range of capabilities like pull, push, clone, and merge. The cross-platform version supports applications for Mac OS and Windows, increasing its versatility across different operating systems. Git Cola is easily customizable into various setting specifications to suit the needs of the user – enhance the work experience and make it hassle-free.
Gitg
Git Sourcetree Macbook
Designed for GNOME, Gitg is a front-end tool meant for Git command line. It’s a small, quick, and convenient Git GUI client that visualizes the Git history and operations benefiting from graphical representations. This tool comes with a wide variety of features like open, commit, and clone repository; stage; et al. It can enable GNOME shell integration. As the GNOME employs a simple and easy to use design, it does not restrict Gitg from offering an exclusive set of functionalities for the OS.
Conclusion
Sourcetree Git Authentication Failed Mac
Whether you’re using Windows, Linux, Mac OS, or Ubuntu operating system, there is always that Git GUI tool or extension which works best with your system. You can explore the GIT clients discussed above and pick one that suits your needs. If it’s for commercial purposes, pick the right one, if it’s a startup business, there is the right one also.