Introduction to Git
Git is a piece of software that allows multiple developers to work together on a project. It provides you with methods of reverting changes through incremental backups, control who can/can't send changes, and more.
In this article, you will be learning how to set your computer up to access repositories on GitHub.
- 1 GitHub Registration
- 2 Installing Git Extensions
- 3 Creating SSH Keys
- 4 Clone ALFA Repository
- 5 Basic Github commands
The first step is to create a GitHub account.
- Open the registration link.
- Provide a username, password, and email that you do not mind other builders knowing.
- You do not need a paid plan.
Once registered, send a message to your HDM or a GitHub tech team owner.
Installing Git Extensions
Git Extensions is the software you will be using to interact with Git. It provides a clean user interface so that you will not have to learn any command line operation.
- Download Git Extensions.
- Check the box to install Git for Windows
- Check the box to install Kdiff
- Use PuTTY instead of OpenSSH.
Creating SSH Keys
- Navigate to the folder where you installed Git Extensions.
- Open the PuTTY subfolder.
- Open puttygen.exe
- Click the generate button.
- Move the mouse around until the bar has finished filling.
- Optional: Type in a comment.
- Optional: Type in a password.
- Save the public key somewhere you'll remember. Your home directory in a ssh folder works. Save it as <comment above>.pub.
- Save the private key in the same place as <comment above>.ppk
- Do not close the window yet!
Teach to GitHub
- Navigate to Github's SSH Settings.
- Click New SSH Key.
- Give the title <comment above>.
- Go back to Putty Generator. Go to the top box and copy the contents.
- Paste the contents into the box on the GitHub website.
- Click Add Key.
- You may now close PuttyGen.
Clone ALFA Repository
(You will need to be added to the build team by the repository owner, probably the Infrastructure Admin or HDM, before cloning.)
- Open up Git Extensions.
- Select Clone GitGub repository from the common actions pane, or if that isn't there, GitHub->Clone/Fork from the dropdown menu.
- Select the second tab to search.
- Search for alfa010_bg or alfa003_tsm.
- Select the one from A Land Far Away by clicking in the first column of the results list.
- Near the bottom, use the Browse button to navigate to your <My Documents>\Neverwinter Nights 2\modules folder. Target it directly into the modules folder, not into a subfolder within the modules folder.
- Rename the local directory from alfa010_bg to alfa010_bg_build or alfa003_tsm to alfa003_tsm_build.
- In Git Extensions, navigate to Repository > Remote Repositories.
- Hit Browse and go to your .ppk file you saved earlier.
- Save changes.
Settings and KDIFF3
- Download and install KDiff3 into your Programs directory https://sourceforge.net/projects/kdiff3/files/kdiff3/
- In Git Extensions, open Tools/Settings.
- Click Repair next to any lines that are red.
- Select KDiff as your merge and diff tools and set the paths to it.
- Leave mergetool and difftool commands, line endings and file content encoding blank.
- Download missing_textures.zip or they will throw dozens of errors the first time you open an alfa module in toolset: https://download.alandfaraway.info/builders/
- Unzip into the same folder as your nwn2.exe file.
- 1) Set Autosave to "False"
- 2) Set Allow Plugins to "Load All Plugins"
Only use Save Directory, not Save.
Basic Github commands
Discard changes prior to commit
You created some changes that are not committed yet. You want to delete or undo these changes.
In GitExtensions, click the appropriate button in the bottom right quadrant.
Click "reset all changes" if you want to reset everything. Click "reset unstaged changes" if you wish to selectively stage files for commit.
Making a commit
Once all of the changes you want to commit are staged, write a message to briefly explain your changes and click the "commit" button.
Amend previous commit
Did you forget something in your previous commit? You can amend it! It deletes the last commit and commits it again with the added changes. Click the "Amend commit" checkbox (above "reset all changes", see image above). Update the commit text if warranted.
Revert a commit
Once published you cannot undo a commit, however, by using a "revert commit," you can effectively undo the changes. Right click and select "revert commit" on the commit you would like to revert. A confirm dialogue pops up. Click "automatically create a commit" if you want to directly commit the reverted changes (do this if you are not sure what to do).