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


                            It’s very easy to synchronize your Git repository with new commits in the original SVN repository. This makes for a comfortable transition period in the migration process where you can continue to use your existing SVN workflow, but begin to experiment with Git.

                            It’s possible to synchronize in both directions. However, we recommend a one-way sync from SVN to Git. During your transition period, you should only commit to your SVN repository, not your Git repo. Once you’re confident that your team is ready to make the switch, you can complete the migration process and begin to commit changes with Git instead of SVN.

                            Git migration: we recommend a one-way sync from SVN to Git.

                            In the meantime, you should continue to commit to your SVN repository and synchronize your Git repository whenever necessary. This process is similar to the Convert phase, but since you’re only dealing with incremental changes, it should be much more efficient.

                            Update the authors file

                            The authors.txt file that we used to map SVN usernames to full names and email addresses is essential to the synchronization process. If it has been moved from the ~/GitMigration/authors.txt location that we’ve been using thus far, you need to update its location with:

                            git config svn.authorsfile <path-to-authors-file>

                            If new developers have committed to the SVN repository since the last sync (or the initial clone), the authors file needs to be updated accordingly. You can do this by manually appending new users to authors.txt, or you can use the --authors-prog option, as discussed in the next section.

                            For one-off synchronizations it’s often easier to directly edit the authors file; however, the---authors-prog option is preferred if you’re performing unsupervised syncs (i.e. in a scheduled task).

                            Automatically generating Git authors

                            If your authors file doesn’t need to be updated, you can skip to the next section.

                            The git svn command includes an option called --authors-prog, which points to a script that automatically transforms SVN usernames into Git authors. You’ll need to configure this script to accept the SVN username as its only argument and return a single line in the form of Name <email> (just like the right hand side of the existing authors file). This option can be very useful if you need to periodically add new developers to your project.

                            If you want to use the --authors-prog option, create a file called authors.sh option in ~/GitMigration. Add the following line to authors.sh to return a dummy Git name and email for any authors that aren’t found in authors.txt:

                            echo "$1 <$1@example.com>"

                            Again, this will only generate a dummy name and email based on the SVN username, so feel free to alter it if you can provide a more meaningful mapping.

                            Fetch the new SVN commits

                            Unlike SVN, Git makes a distinction between downloading upstream commits and integrating them into the project. The former is called "fetching", while the latter can be done via merging or rebasing. In the ~/GitMigration directory, run the following command to fetch any new commits from the original SVN repository.

                            git svn fetch

                            This is similar to the git svn clone command from the previous phase in that it only updates the Git repository’s remote branches--the local branches will not reflect any of the updates yet. Your remote branches, on the other hand, should exactly match your SVN repo’s history.

                            If you’re using the --authors-prog option, you need include it in the above command, like so:

                            git svn fetch --authors-prog=authors.sh

                            Synchronize with the fetched commits

                            To apply the downloaded commits to the repository, run the following command:

                            java -Dfile.encoding=utf-8 -jar ~/svn-migration-scripts.jar sync-rebase

                            This will rebase the fetched commits onto your local branches so that they match their remote counterparts. You should now be able to see the new commits in your git log output.

                            Clean up the Git repo (again)

                            It’s also a good idea to run the git-clean script again to remove any obsolete tags or branches that were deleted from the original SVN repository since the last sync:

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

                            Your local Git repository should now be synchronized with your SVN repository.


                            During this transition period, it’s very important that your developers only commit to the original SVN repository. The only time the Git repository should be updated is via the synchronization process discussed above. This is much easier than managing a two-way synchronization workflow, but it still allows you to start integrating Git into your build process.