py-gang / git-workshop

A repo to gain basic git collaboration experience
MIT License
0 stars 0 forks source link

Module 0. Preps #10

Open OleksiyRudenko opened 5 years ago

OleksiyRudenko commented 5 years ago

This module is expected to be completed before workshop. Please, get prepared properly to save your and your team mates time during workshop.

You will perform this setup once per device benefiting from this all the time further.

To be well prepared you have:

The last instruction will decrease a risk of tracking of the most common files to be ignored even if the project doesn't contain its own .gitignore. You will also have some useful git aliases set up. We will use git logg to have a nicer output of repo history.

  • your editor/IDE ensures empty line at the end if file. Find and check the relevant setting. Examples:
  • IntelliJ IDEA products: File > Settings (or ProductName > Preferences) > Editor > General -- Ensure line feed at file end on Save
  • VS Code
  • Sublime: Command Palette > Preferences -- change or add "ensure_newline_at_eof_on_save": false

This ensures that adding code/text at the end if file will not mark changed the fragment that actually had not been effectively changed (which takes place when a line doesn't end with LF character). This makes history of changes cleaner and diffs reflecting actual changes.

OleksiyRudenko commented 5 years ago

Credential manager for Linux Mint/Ubuntu

Run the following commands:

sudo apt-get install libsecret-1-0 libsecret-1-dev
cd /usr/share/doc/git/contrib/credential/libsecret
sudo make
git config --global credential.helper /usr/share/doc/git/contrib/credential/libsecret/git-credential-libsecret

If any command fails try googling the error message to fix the issue.

Alternatively, you my try Git Credential Manager from Microsoft

OleksiyRudenko commented 5 years ago

Git Editor

By default git uses vi or vim to edit commit messages, manage interactive rebasing etc. You may find those not friendly enough. Check [this] out to know how to set up alternatives.

Recommended alternative editors follow.

Windows

It is not recommended to use Notepad.exe that comes bundled along with Windows as it may not treat line endings properly, which may result in numerous warnings from git and bring some mess in your commits.

Recommended: Notepad++

Linux/MacOS

nano - a better CLI text editor

sudo apt-get install nano
git config --global core.editor "nano"

VSC - a full-fledged IDE, yet lightweight enough to start fast.

Under MacOS you may need to move unpacked VSC bundle to Applications for the following command to have a positive effect. Detailed instructions.

The code below must be a single line of text: git config --global core.editor "/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code --wait"

Under other Linux systems you may need to find and change code executable location appropriately.

Note the --wait param, which may be required to help git properly handle an editing session by many GUI editors. Just in case you want to use anything different, e.g. Sublime. Consult editors documentation for integrating the edit of your choice with git, or just google EDITOR-NAME integration with git.

Other options

GNU emacs is a good choice among x-platform GUI editors.