Git Practices - nortikin/sverchok GitHub Wiki

Git instructions

This page is primarily aimed at Git novices. If that's you, keep reading. Else feel free to correct the info.

Use a branch

Never edit code directly in Master. Never? Never! If you want to make changes do it in a branch.
- side note: Main developers might sometimes change things directly in Master. That doesn't mean it's a good idea, and certainly doesn't mean you should adopt that bad habit.

Proper procedure

The proper procedure to editing code for the first time is:

  1. git checkout master ( if you aren't in master already)

  2. git pull (get all recent changes... do it anyway.. it will just say it's up to date if no changes are found )

  3. git checkout -b some_new_branch_name (might take a few seconds, it makes a branch and switches to it)

  4. git push --set-upstream origin some_new_branch_name (... just do it. Also: google it)

  5. edit the code.

  6. periodically (every cohesive change), save your progress by:
    git add -A.
    git commit -am "commit message".
    - keep the part between double quotes descriptive and short, use this convention and you'll thank yourself later in life.

  7. To test the changes hit F8 if Blender is running. Sometimes a restart of Blender may be necessary, this is normal.

returning to your branch at a later stage

One you have edited code in a previous session, and want to continue editing make sure you don't have any uncommitted code. It's easy to forget to commit code. Git won't let you change branches if you have uncommitted code. This is great because it's a reminder that there's code you need to commit before doing anything else.

  • Write down the name of the current branch.
  • do git status. This will tell you if you have uncommitted code in your current branch.

if you have uncommitted code, then you have several options but let's stick to just committing and pushing.

  • git add -A
  • git commit -am "post code commit"
  • git push

Now you are free to change branch to master (and pull) or to keep editing code.

Tips

Howto install blender addons from github with one command, use alias (~/.bashrc file)

for ~/src directory blender 2.9:

alias LNaddon='{ read -r url&&cd ~/src&&git clone $url&&bn=$(basename $url .git)&&cd $bn&&d=$(pwd)&&us=$(users)&&ln -s $d /home/$us/.config/blender/2.93/scripts/addons/&&echo "2.93 linked" ;} <<< '

Usage LNaddon [email protected]:nortikin/sverchok.git

Howto discard changes

If you do not want to commit changes and not need them, than discard: git checkout -- .

⚠️ **GitHub.com Fallback** ⚠️