Migrating to Git


  • Setting up local access to your fork

    When making changes to your local installation, you will need to be able to update the online repository so that you can push changes to Frappe / ERPNext, as well as keep revisions on GitHub, etc.

    Access your local installation using a terminal and go to the frappe-bench folder

    For each app you have created, use the following commands to establish a remote to your repo:

    cd apps/[app_name]
    git remote add originhttps://github.com/[username]/[app_name]
    

    Use the following command (in each apps/app_name folder) to verify the remote has been added

    git remote -v
    

    ****

    Starting to write your own code

    When you start making changes, whether to frappe/erpnext, or to modify your own app, you need to track those changes within a new branch. This allows your to push just these changes to your own github repository, which will allow you to create pull requests and merge the branch into the frappe/erpnext code, or your own app. The full procedure for starting changes all the way to pushing to your online repository is described below.

    Go to your app/[app_name] folder on your local server (through a terminal)

    Create a new local branch:

    git checkout -b [my_branch_name]
    

    Make changes to your app. This can be done either in the code of your app, or using the web interface of frappe to edit/add doctypes, etc.

    When finished making changes, go back to the terminal in your app/[app_name] folder and find out which files have been modified:

    git status
    

    A list of files, each highlighted red will appear. If you want to include the changes to those files in your commit, add them using:

    git add [file_name]
    

    If you want to add all the files that were changed, use:

    git add .
    

    Commit the changes to the branch

    git commit -m "[message]"
    

    where the message is a short description of the changes you made in this commit

    Push the changes from this commit to your repository

    git push origin [my_branch_name]
    

Did you find this article useful?