Announcement

Collapse
No announcement yet.

Best Practices for Source Control

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Best Practices for Source Control

    Hello,
    Thanks In advance,

    We are a rookie team and we are thinking of observing the following rules for source control:

    a. clone the latest repo from ftc app using the following command:
    --SNIP--
    git clone https://github.com/ftctechnh/ftc_app.git
    --SNIP--
    Note that it does not use "--depth=1" as recommended on the github site (for a special reason). This will download ~1GB of the repo (instead of 250 MB with --depth param)

    b. Create our teams repo on github. say the repo is "git@github.com:<username>/test_repo.git"

    c. follow the follwing steps one time to set up:
    $ cd ftc_app
    $ git remote -v
    origin https://github.com/ftctechnh/ftc_app.git (fetch)
    origin https://github.com/ftctechnh/ftc_app.git (push)


    $ git remote rename origin official
    $ git remote -v
    official https://github.com/ftctechnh/ftc_app.git (fetch)
    official https://github.com/ftctechnh/ftc_app.git (push)

    $ git remote add origin git@github.com:<username>/test_repo.git
    $ git remote -v
    official https://github.com/ftctechnh/ftc_app.git (fetch)
    official https://github.com/ftctechnh/ftc_app.git (push)
    origin git@github.com:kaavla/alpacas_ftc_2018.git (fetch)
    origin git@github.com:kaavla/alpacas_ftc_2018.git (push)


    $ git push -u origin master


    d. Now whenever i want to upgrade to the latest version on ftc app, we can just do:
    $ git fetch official master
    $ git pull official master

    e. And our local changes can be pushed to:
    $ git push origin master


    Let me know if there are any better practices that are recommended.

    Best Practices for Source Control

  • #2

    What about forking the ftc_app into your own github repo, cloning that to your local machine then commit and push at the end of every coding session (obviously branch if necessary)?

    Also, couldn't you add a deprecated version of one of ftc's files to your team code, allowing you to keep depth to a minimum? Maybe i misunderstand. Probably, in fact.
    Mentor, teams 8578 & 11959

    Comment


    • #3
      We do something similar, with similar results.- but slightly different. We fork the FTC repo into our own on github. We then clone our fork to a local directory. We then add a remote (called upstream). To avoid any chance that one of the inexperienced users attempts to push to upstream (FTC) instead of origin (our fork), we rename the push address to NO_PUSH (can be any invalid string for the URL). There are online examples that follow this pattern.
      When pushing to and pulling from our fork, we use origin. When to FTC SDK releases, we use upstream.
      Note in your step d above, you do a fetch and then a pull. You should do a fetch and then a merge OR a pull. pull is just fetch and merge combined. The separate fetch/merge is often better if you have changed some of the FTC files and could have merge issues.
      The next step to decide is one level beyond what you discuss - handling multiple developers on separate dev machines. You can allow all of your users to push to your team fork, or you can have each user fork the team fork, and then use pull requests. The latter is "safer" in that you maintain control over what goes into the team repo, but is more difficult to teach/manage with inexperienced users. The former carries the risk of a student pushing something that breaks things, but you always have the commit history to get things back to a same state.

      Comment

      Working...
      X