Developing FreeCAD with GitKraken - FreeCAD Documentation (2024)

From FreeCAD Documentation

Other languages:

  • Deutsch
  • English
  • français
  • italiano
  • polski

Foreword

FreeCAD uses Git to manage its source code. This document is a cursory introduction to GitKraken, a graphical user interface to Git. GitKraken is proprietary software that is free to use for non-commercial use; you don't need GitKraken to develop code for FreeCAD but many developers like it, and find it useful to manage their development. FreeCAD doesn't endorse GitKraken but we hope a guide like this one shows users how easy it is to set up the development environment and encourages more people to contribute.

For more information on general Git usage from the command line see Source code management, and the online Pro Git book. To compile FreeCAD see Compiling.

Introduction

Git is a powerful revision control system commonly used to track computer code development. Although it is a complex system, you usually only need some background information on how it works, and to know a few terminal commands. A graphical user interface (GUI) eases the learning curve. GitKraken is a proprietary program that is free to use for non-commercial use that runs on the Electron framework, which means it is cross platform and can be used the same in Linux, MacOS, and Windows.

Setting up Git development

There are different ways to download GitKraken depending on your operating system. In Linux distributions, sometimes you can get it from the package manager.

  1. Download GitKraken.
  2. In your web browser go to: https://github.com/FreeCAD/FreeCAD.
  3. Click the Fork button. This will clone the FreeCAD/FreeCAD repository to your own account. In other words the URL to access your fork will be:
    https://github.com/GITHUBUSERNAME/FreeCAD.git
  4. Open GitKraken, go to File → Clone Repo, and enter this address.
  5. GitKraken will now git clone your personal repository.Please read the difference between origin vs. upstream remote repository. Essentially, your fork of FreeCAD is the origin repository, while the official FreeCAD repository is upstream. You now need to set the upstream accordingly.
  6. Locate the sidebar in Gitkraken. There is a Local and Remote section. Local refers to your local branches. Remote refers to remote repositories and their branches. Lets add the FreeCAD repo as a remote. In the Remote section click the + (as illustrated in the image below).
  7. An Add Remote dialog will open. Click the Github symbol (1). In the Github repo field (2) find the FreeCAD/FreeCAD and click on it. In the Name field, type upstream. Then click the Add Button.
  8. The dialog will close and switch back to GitKraken main interface. This time find the Local section in the sidebar; double click on the master branch so you switch to it. In the command line, this is equivalent to
    git checkout master
  9. Click on the Push icon on the top right side of the interface. This will push your Local master to your Remote origin master

The GitKraken interface

For more information consult the GitKraken Getting started guide.

Local indicates your local machine
Local masterYour local branch of the FreeCAD master branch, indicated by the blue line in the screenshot.

The item is highlighted in green, meaning that the branch is currently active (git checkout).

Local <branch-name>Any other branches on your local machine. In the screenshot you can see branches called editor_fixes and editor_fixes_typos
Remote indicates a remote repository, for example in GitHub
Remote upstreamThe official FreeCAD repository https://github.com/FreeCAD/FreeCAD, indicated by the green line in the screenshot.
Remote originYour personal fork of FreeCAD, https://github.com/YourGitHubUsername/FreeCAD, indicated by the red line in the screenshot.

GitKraken interface showing three local branches including a local master, and remote origin and upstream repositories, each of which have a master and release branches.

In the image, the remote the Local master and Remote origin master branches are three commits behind the Remote upstream master, that is, the official FreeCAD source code. This is indicated by the icons being three steps behind in the chain that represents the commit history of the master branch. See Rebasing to update the branches that are behind.

Rebasing

  • Checkout the Local master branch by double clicking on it (git checkout master)
  • Move the mouse to the last upstream commit, right click, and choose Rebase master onto upstream/master (git pull upstream master)
  • Now press the Push button (git push origin master). This pushes from your Local master to the Remote origin master.

Rebasing a local master updates it so that it matches the contents of the upstream master.

Branches

Branches are a feature that makes Git powerful compared to other revision systems. Branches aren't complete forks, but rather define snapshots where a version of the code starts diverging from the master branch. Whenever you want to modify the FreeCAD code, first create a branch, then make changes, and then merge your commits back to the master branch. With Git it is simple to create, merge and delete branches when you no longer need them. Please read Branching and Merging to understand more about this process in GitKraken.

  1. Make sure you currently have the master branch active (double click on it, git checkout master). In GitKraken the Local master branch should be highlighted in green.
  2. Click the Branch button to create a new branch and enter its new name (git checkout -b new-name-of-your-branch).

Making pull requests

Pull requests (PRs) are necessary to merge the code in a branch in your local repository with the code in the upstream repository. To summarize the process, once you've modified your branch, you need to push it to your GitHub fork (origin, https://github.com/GITHUBUSERNAME/FreeCAD.git), and from there make a pull request to upstream. GitKraken saves you some clicks to easily create pull requests instead of using GitHub's interface.

Steps in GitKraken:

  • Find you local branch on the interface and make sure it's active (double click on it).
  • Right click the branch name and find the option to Push <your-branch-name> and start a pull request.
GitKraken will open a dialog that asks you to confirm the repository which your branch will use to pull and push. It will then push your local branch to that remote repository.

  • GitKraken will ask you what you want to call the remote branch. The default name is the same name that the branch has locally in your computer.

  • GitKraken then opens up another dialog asking the repositories and branches to merge, and the direction (from and to).
You normally want to merge from the remote origin <your-branch-name> (GITHUBUSERNAME/FreeCAD) to the remote upstream master branch (FreeCAD/FreeCAD). Be sure to enter a good title for the pull request, and write a more descriptive paragraph if your changes are significant. Consult the official documentation of GitKraken for more information.

Resolving merge conflicts

GitKraken has a special merge conflict tool that is only accessible in the GitKraken Pro version. However, there are workarounds to use external tools for merging.

Squashing commits

As a revision control system Git encourages making many commits to keep track of your changes; however, if you have too many small changes the commit history may look a bit messy. Squashing is condensing various commits into only one commit. From the GitKraken manual, squashing is available for commits that meet the following requirements:

  • You need to select at least two commits to squash.
  • The youngest commit, by commit date, is also the current HEAD commit.
  • Genealogically consecutive.
  • Chronologically consecutive.
  • The oldest commit in the list has a parent.

If all these conditions are met, the Squash option appears when you right click the commit node. See Squash.gif

Following other FreeCAD repositories

You can use GitKraken to follow the personal FreeCAD forks of other developers; in this way you can see how they write code and commit changes to their own branches before they submit pull requests to the upstream FreeCAD/FreeCAD repository.

  1. In the left side panel next to the Remote category, press the + sign.
  2. A dialogue will come up to enter the name of the repository that you want to add. Recommended remotes are from the main FreeCAD developers and known contributors: wmayer, yorikvanhavre, ickby, sliptonic, kkremitzki, etc.
  3. Press Add Remote.

Now whenever new commits are made, or branches are rebased, by the authors of those repositories, you will see their commit history in a graphical way.

Related

  • Source code management
  • Developing FreeCAD with KDevelop

User documentation

  • Getting started
  • Installation: Download, Windows, Linux, Mac, Additional components, Docker, AppImage, Ubuntu Snap
  • Basics: About FreeCAD, Interface, Mouse navigation, Selection methods, Object name, Preferences, Workbenches, Document structure, Properties, Help FreeCAD, Donate
  • Help: Tutorials, Video tutorials
  • Workbenches: Std Base, Assembly, BIM, CAM, Draft, FEM, Inspection, Material, Mesh, OpenSCAD, Part, PartDesign, Points, Reverse Engineering, Robot, Sketcher, Spreadsheet, Surface, TechDraw, Test Framework
  • Addons: Addon Manager, External workbenches, Scripting and macros
  • Hubs: User hub, Power users hub, Developer hub

Retrieved from ""

Developing FreeCAD with GitKraken - FreeCAD Documentation (2024)
Top Articles
Peanut Butter Blossoms Recipe | The Tummy Train
Lunch Lady Peanut Butter Bars Recipe
2022 Basketball 247
Wsbtv Fish And Game Report
Obituaries in South Bend, IN | South Bend Tribune
Swgoh Darth Vader Mods
Sofia Pinkman
Tinyzonehd
Dtm Urban Dictionary
Wieting Funeral Home
What Was D-Day Weegy
Jobs Hiring Start Tomorrow
Unlockme Cintas
John W Creasy Died December 16 2003
92801 Sales Tax
Myth or Fact: Massage Parlors and How They Play a Role in Trafficking | OUR Rescue
Megnutt Health Benefits
Binny Arcot
Usccb 1 John 4
Stolen Touches Neva Altaj Read Online Free
Fortnite Chapter 5: All you need to know!
Huffington Post Horoscope Libra
Dumb Money, la recensione: Paul Dano e quel film biografico sul caso GameStop
Integral2 seems to substitute non-scalar values of variable into in...
Fortnite Fap Hero
Seconds Valuable Fun Welcoming Gang Back Andy Griffith's Birthday A Top Wish So A Happy Birthday FZSW A Fabulous Man Kevin Talks About Times From Ten Day Weekend Fun Labor Day Break
Jvid Rina Sauce
Cars & Trucks By Owner
Gabrielle Enright Weight Loss
Stuckey Furniture
Bolly2Tolly Sale
South Carolina Title Transfer Does Sc Require Notary Seal For Auto Title Transfer
Ups Customer Center Locations
Krunker.io . Online Games . BrightestGames.com
Rocking Horse Ranch Itinerary
Best Jumpshot
Ebk Jaaybo Net Worth
Dumb Money Showtimes Near Cinemark Century Mountain View 16
Advanced Auto Body Hilton Head
Fandafia
Foolproof Module 6 Test Answers
Borderlands 2 Mechromancer Leveling Build
How Much Does Costco Gas Cost Today? Snapshot of Prices Across the U.S. | CostContessa
Texas State Academic Probation
Thoren Bradley Lpsg
Desi Cinemas.com
How Big is a 4×6 Photo?(Inch, cm, mm, Ft, Pixels) - PhotographyAxis
Dean of Students | Alcohol & Drug Policies
Bonbast قیمت ارز
Espn Ppr Fantasy Football Rankings
XY6020L 6-70V CNC einstellbares stabilisiertes Spannungsnetzteil Konstantspannung Konstantstrom 20A/1200W Buck-Modul Bewertungen
Temperature At 12 Pm Today
Latest Posts
Article information

Author: Laurine Ryan

Last Updated:

Views: 6382

Rating: 4.7 / 5 (57 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Laurine Ryan

Birthday: 1994-12-23

Address: Suite 751 871 Lissette Throughway, West Kittie, NH 41603

Phone: +2366831109631

Job: Sales Producer

Hobby: Creative writing, Motor sports, Do it yourself, Skateboarding, Coffee roasting, Calligraphy, Stand-up comedy

Introduction: My name is Laurine Ryan, I am a adorable, fair, graceful, spotless, gorgeous, homely, cooperative person who loves writing and wants to share my knowledge and understanding with you.