2

I'm part of a small data analytics team, and want to start using a remote repository to handle our shared scripts, which are currently kept on a network drive and sourced from there by members of the team as needed. These scripts are used to generate reports once a week to several times daily, and are often edited throughout the day, so it is important that everyone has sourced the latest version before running their script.

I've looked around for git workflow advice on various stack sites, but most of it is geared toward more rigorous software development use cases.

What workflow would be ideal for my situation? My first instinct is to just pull from the remote repository before running any script to make sure that I am using the latest version, though this seems clunky. Ideally, I could source and run the scripts in a single go (e.g. a function call). Any help greatly appreciated!

2 Answers2

2

If you are working only with one branch (for instance, the default master), simply set (with Git 2.6 or more):

git config --global pull.rebase true
git config --global rebase.autoStash true

From there, a simple git pull will:

  • stash your work in progress
  • fetch origin/master
  • rebase your local commits (not yet pushed) on top of the up-to-date origin/master
  • pop your work in progress back in place
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
1

You can go for simple branching strategy with just two branches (master, develop). master holding production ready code. develop holding in-progress code. Refer to the below image & also the branching strategy article.

Always pull from master branch for running analytical reports. Use develop branch code for testing in-progress development reports. Once development is done for a reporting query, merge the develop branch to master branch.

enter image description here

Venkataraman R
  • 12,181
  • 2
  • 31
  • 58