User Tools

Site Tools


using_git

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
using_git [2018/06/18 02:27]
be.ing
using_git [2020/02/04 20:42]
mevsme [Set up Git]
Line 3: Line 3:
 Mixxx uses [[http://​git-scm.com/​|Git]] for source control. Git is a distributed version control system that allows us to keep track of how our code changes and work together on it. Our code is hosted on [[https://​github.com/​mixxxdj/​mixxx|GitHub]]. This page aims to get you up to speed with the basics of Git and how to use it with our workflow on GitHub. We are intentionally glossing over a lot of finer details which are explained in other [[#​Tutorials]]. ​ Mixxx uses [[http://​git-scm.com/​|Git]] for source control. Git is a distributed version control system that allows us to keep track of how our code changes and work together on it. Our code is hosted on [[https://​github.com/​mixxxdj/​mixxx|GitHub]]. This page aims to get you up to speed with the basics of Git and how to use it with our workflow on GitHub. We are intentionally glossing over a lot of finer details which are explained in other [[#​Tutorials]]. ​
  
 +If you have still have questions after reading this, feel free to ask on [[https://​mixxx.zulipchat.com/​|Zulip]].
 ====== Install Git ====== ====== Install Git ======
 Git comes preinstalled on macOS and many GNU/Linux distributions. If not, then install the ''​git''​ package through your distribution'​s package manager. On Windows, download and install Git from [[http://​git-scm.com/​downloads/​|git-scm.org]]. In addition to the command line tool, there are lots of [[https://​git-scm.com/​downloads/​guis|GUI Git Clients]] available. Many IDEs have some integrated Git functionality or have a plugin for using Git within the IDE. Git comes preinstalled on macOS and many GNU/Linux distributions. If not, then install the ''​git''​ package through your distribution'​s package manager. On Windows, download and install Git from [[http://​git-scm.com/​downloads/​|git-scm.org]]. In addition to the command line tool, there are lots of [[https://​git-scm.com/​downloads/​guis|GUI Git Clients]] available. Many IDEs have some integrated Git functionality or have a plugin for using Git within the IDE.
Line 31: Line 32:
 to switch to the upstream master branch. to switch to the upstream master branch.
  
 +\\
 +If you get an error that says: 
 +<code bash>
 +error: Your local changes to the following files would be overwritten by checkout:
 +some/​file/​path.h
 +another/​file/​name.cpp
 +Please commit your changes or stash them before you switch branches.
 +Aborting
 +</​code>​
 +
 +You can discard your local changes by
 +''​ git reset --hard''​ or ''​git checkout -t -f remote/​branch''​
 +
 +\\
 +\\
 Configure Git so that you push to your fork by default for new branches: Configure Git so that you push to your fork by default for new branches:
 <​code>​ <​code>​
Line 64: Line 80:
 If you want your changes included in a current beta release or a bugfix point release (such as 2.1.1), start your new branch from the release branch instead of the master branch, for example: If you want your changes included in a current beta release or a bugfix point release (such as 2.1.1), start your new branch from the release branch instead of the master branch, for example:
 <​code>​ <​code>​
-git checkout -b fixing_some_bug upstream/2.1+git checkout -b fixing_some_bug upstream/2.2
 </​code>​ </​code>​
  
Line 115: Line 131:
  
 To work on another bug or feature, [[#create a new branch]]. To work on another bug or feature, [[#create a new branch]].
 +
 +====== Targeting another base branch ======
 +Sometimes you [[#​create_a_new_branch|started your work]] from the wrong base branch. Maybe you wrote a bugfix or a controller mapping that should be merged into current stable release, but started from the ''​master''​ branch instead of the stable version'​s branch.
 +
 +In these cases you need to [[https://​git-scm.com/​book/​en/​Git-Branching-Rebasing|rebase]] your work on the correct branch. For example, the current stable version is 2.2.3 and you want your changes to be a part of the 2.2.4 release, but you based your work on ''​master'',​ you need to rebase onto the ''​2.2''​ branch.
 +
 +To rebase your work in the ''​fixing_some_bug''​ branch from ''​master''​ onto ''​2.2'',​ run:
 +<​code>​
 +git fetch upstream
 +git rebase --onto upstream/​2.2 upstream/​master fixing_some_bug
 +</​code>​
 +
 +Since this changes commits that you already pushed to the server, you need to use the ''​-f''​ flag when pushing the changes to the remote repository:
 +<​code>​
 +git push -f origin fixing_some_bug
 +</​code>​
 +
 +
 +If you already opened a PR, you need to [[https://​help.github.com/​en/​github/​collaborating-with-issues-and-pull-requests/​changing-the-base-branch-of-a-pull-request|change its base branch]]. ​
 +
  
 ====== Keeping up to date with upstream ====== ====== Keeping up to date with upstream ======
Line 142: Line 178:
 All of these tutorials are interactive and guide you with helpful graphics. Don't worry if you don't understand everything the first time. All of these tutorials are interactive and guide you with helpful graphics. Don't worry if you don't understand everything the first time.
  
-{{https://imgs.xkcd.com/comics/git.png}}+{{:​git-xkcd.png}} 
 + 
 +Image from [[https://​xkcd.com/​1597/|xkcd]]
  
 ====== Working on mappings and skins separately from other changes ====== ====== Working on mappings and skins separately from other changes ======
using_git.txt · Last modified: 2020/03/25 11:30 by be.ing