1. Learn Git
    1. Learn Git with Bitbucket Cloud
      1. Create a Git repository
      2. Copy your Git repository and add files
      3. Pull changes from your Git repository on Bitbucket Cloud
      4. Use a Git branch to merge a file
    2. Learn about code review in Bitbucket Cloud
      1. Fork a teammate's repository
      2. Copy your fork and make a change to the repository
      3. Create a pull request
  2. Getting Started
    1. What is version control
      1. Benefits of version control
    2. What is Git
      1. Performance
      2. Security
      3. Flexibility
      4. Version control with Git
    3. Why Git for your organization
      1. Git for developers
      2. Git for marketing
      3. Git for product management
      4. Git for designers
      5. Git for customer support
      6. Git for human resources
      7. Git for anyone managing a budget
    4. Install Git
      1. Install Git on Mac OS X
      2. Install Git on Windows
      3. Install Git on Linux
    5. Setting up a repository
      1. git init
      2. git clone
      3. git config
    6. Saving changes
      1. git add
      2. git commit
    7. Git Stash
      1. .gitignore
        1. Inspecting a repository
          1. git status
          2. git log
        2. Viewing old commits
          1. Undoing Changes
            1. git checkout
            2. git revert
            3. git reset
            4. git clean
          2. Rewriting history
            1. git commit --amend
            2. git rebase
            3. git rebase -i
            4. git reflog
        3. Collaborating
          1. Syncing
            1. git remote
            2. git fetch
            3. git pull
            4. git push
          2. Making a Pull Request
            1. How it works
            2. Example
            3. Where to go from here
          3. Using Branches
            1. git branch
            2. git checkout
            3. git merge
          4. Comparing Workflows
            1. Centralized Workflow
            2. Feature Branch Workflow
            3. Gitflow Workflow
            4. Forking Workflow
        4. Migrating to Git
          1. SVN to Git - prepping for the migration
            1. For administrators
            2. Basic Git commands
            3. Git Migration Tools
            4. For developers
          2. Migrate to Git from SVN
            1. Prepare
              1. Convert
                1. Synchronize
                  1. Share
                    1. Migrate
                      1. Perforce to Git - why to make the move
                        1. Migrating from Perforce to Git
                        2. Advanced Tips
                          1. Advanced Git Tutorials
                            1. Merging vs. Rebasing
                              1. Conceptual Overview
                              2. The Golden Rule of Rebasing
                              3. Workflow Walkthrough
                              4. Summary
                            2. Reset, Checkout, and Revert
                              1. Commit-level Operation
                              2. File-level Operations
                              3. Summary
                            3. Advanced Git log
                              1. Formatting Log Output
                              2. Filtering the Commit History
                              3. Summary
                            4. Git Hooks
                              1. Conceptual Overview
                              2. Local Hooks
                              3. Server-side Hooks
                              4. Summary
                            5. Refs and the Reflog
                              1. Hashes
                              2. Refs
                              3. Packed Refs
                              4. Special Refs
                              5. Refspecs
                              6. Relative Refs
                              7. The Reflog
                              8. Summary
                            6. Git LFS


                            The next step in the migration from SVN to Git is to import the contents of the SVN repository into a new Git repository. We’ll do this with the git svn utility that is included with most Git distributions, then we’ll clean up the results with svn-migration-scripts.jar.

                            Beware that the conversion process can take a significant amount of time for larger repositories, even when cloning from a local SVN repository. As a benchmark, converting a 400MB repository with 33,000 commits on master took around 12 hours to complete.

                            For reasonably sized repositories, the following steps should be run on the migration lead’s local computer. However, if you have a very large SVN repository and want to cut down on the conversion time, you can run git svn clone on the SVN server instead of on the migration lead’s local machine. This will avoid the overhead of cloning via a network connection.

                            Clone the SVN repository

                            The git svn clone command transforms the trunk, branches, and tags in your SVN repository into a new Git repository. Depending on the structure of your SVN repo, the command needs to be configured differently.

                            Git migration: git svn clone command

                            Standard SVN layouts

                            If your SVN project uses the standard /trunk, /branches, and /tags directory layout, you can use the --stdlayout option instead of manually specifying the repository’s structure. Run the following command in the ~/GitMigration directory:

                            git svn clone --stdlayout --authors-file=authors.txt
                             <svn-repo>/<project> <git-repo-name>

                            Where <svn-repo> is the URI of the SVN repository that you want to migrate and, <project> is the name of the project that you want to import, and <git-repo-name> is the directory name of the new Git repository.

                            For example, if you were migrating a project called Confluence, hosted on https://svn.atlassian.com, you might run the following:

                            git svn clone --stdlayout --authors-file=authors.txt
                             https://svn.atlassian.com/Confluence ConfluenceAsGit

                            Non-standard SVN layouts

                            If your SVN repository doesn’t have a standard layout, you need to provide the locations of your trunk, branches, and tags using the --trunk, --branches, and --tags command line options. For example, if you have branches stored in both the /branches directory and the /bugfixes directories, you would use the following command:

                            git svn clone --trunk=/trunk --branches=/branches 
                             --branches=/bugfixes --tags=/tags --authors-file=authors.txt 
                             <svn-repo>/<project> <git-repo-name>

                            Inspect the new Git repository

                            After git svn clone has finished (this might take a while), you’ll find a new directory called <git-repo-name> in ~/GitMigration. This is the converted Git repository. You should be able to switch into <git-repo-name> and run any of the standard Git commands to explore your project.

                            Branches and tags are not imported into the new Git repository as you might expect. You won’t find any of your SVN branches in the git branch output, nor will you find any of your SVN tags in the git tag output. But, if you run git branch -r, you’ll find all of the branches and tags from your SVN repository. The git svn clone command imports your SVN branches as remote branches and imports your SVN tags as remote branches prefixed with tags/.

                            Git migration: structure of cloned Git repo

                            This behavior makes certain two-way synchronization procedures easier, but it can be very confusing when trying to make a one-way migration Git. That’s why our next step will be to convert these remote branches to local branches and actual Git tags.

                            Clean the new Git repository

                            The clean-git script included in svn-migration-scripts.jar turns the SVN branches into local Git branches and the SVN tags into full-fledged Git tags. Note that this is a destructive operation, and you will not be able to move commits from the Git repository back into the SVN repository.

                            If you’re following this migration guide, this isn’t a problem, as it advocates a one-way sync from SVN to Git (the Git repository is considered read-only until after the Migrate step). However, if you’re planning on committing to the Git repository and the SVN repository during the migration process, you should not perform the following commands. This is an advanced task, as is not recommended for the typical project.

                            To see what can be cleaned up, run the following command in ~/GitMigration/<git-repo-name>:

                            java -Dfile.encoding=utf-8 -jar ~/svn-migration-scripts.jar clean-git

                            This will output all of the changes the script wants to make, but it won’t actually make any of them. To execute these changes, you need to use the --force option, like so:

                            java -Dfile.encoding=utf-8 -jar ~/svn-migration-scripts.jar clean-git 

                            You should now see all of your SVN branches in the git branch output, along with your SVN tags in the git tag output. This means that you’ve successfully converted your SVN project to a Git repository.


                            In this step, you turned an SVN repository into a new Git repository with the git svn clone command, then cleaned up the structure of the resulting repository with svn-migration-scripts.jar. In the next step, you’ll learn how to keep this new Git repo in sync with any new commits to the SVN repository. This will be a similar process to the conversion, but there are some important workflow considerations during this transition period.