Git Clean Sourcetree

Posted on  by admin
Sourcetree for git

This page gives a quick introduction on how to use interactive rebaseto clean up commits on your cloned. This is often required before submitting a pull request to the main ArduPilot repo.

Git client sourcetree

I'm using Git-1.9.0-preview20140217 for Windows. As I know, this release should fix the issue with too long filenames. Surely I'm doing something wrong: I did git config core.longpaths true and git add. And then git commit. Everything went well. But when I now do a git status, I get a list of files with Filename too long, for. How to Use prune to Clean Up Remote Branches in Git. One of the great things about Git is that it's very careful about deleting data.This makes it pretty hard to lose commits or other valuable data in Git! A small downside of this is that you might sometimes see stale data that you actually don't need anymore.

Git Clean Sourcetree

These instructions give the command line instructions but the same operations can be doneusing Git GUI editors including SourceTree.

Steps in an interactive rebase¶

  • open up a terminal and cd to your clone’s directory, checkout the branch you wish to cleanup

  • use the git rebase -i command with the range of commits to be modified. For example to modify any of the last 10 commits:

  • in the terminal that pops up (see top image on this page) find the commits you wish to modify and replace their pick with one of the following letters:

    • s for squash will combine the commit with the previous commit. In the example above “AP_HAL_F4Light: fixed some support scripts” and “AP_HAL_F4LIGHT: small fix (NFC)” will be “squashed” together into a single commit
    • r for reword allows you to change the subject and description of the commit. Note that you cannot simply modify the subject line in the viewer. First you mark it with r and later git will pop up another view to allow you to modify the subject and description
    • e for edit allows you to modify what is in the commit (i.e. add or take away changes)
    • d will remove the commit, alternatively you can just delete the line from the viewer
    • you may also move lines up or down to re-order the commits
  • save and exit the viewer. git will run through the file from top to bottom and pause when required to allow you to make the changes you have requested.

    • if a commit was marked with s for squash, another viewer will pop-up to ask you to provide the commit message and subject line.

    • if a commit was marked with e for edit, the viewer will return to the regular command line.Edit the files as you wish, commit the changes and then tye gitrebase--continue to allow git to continueprocessing the other changes.

When things go wrong¶

Git Clean Sourcetree

Bitbucket Sourcetree Git

If you change the order of commits or edit their contents merge conflicts may occur. If you can resolve these with amerge tool (like TortoiseMerge) then you can allow the interactive rebase to continue by typing:

Git Client Sourcetree

Sourcetree

alternatively you may wish to abort the interactive rebase which will return your branch to its original condition before the interactive rebase was begun