-
Notifications
You must be signed in to change notification settings - Fork 0
Description
After a bit of trial and beta back and forth GitHub CodeSpaces are now available for free to all GitHub users. CodeSpaces are essentially next step from the web based VS Code editor we've already explored. The addition is that we now also have access to an actual linux terminal.
In this issue:
- Start a Code Space
- Work from there as if it was your own PC - but in a shared setup
- Open a new development branch on an issue - from the command line
- Tweak the CodeSpace to your team's standards by adding a
.devcontainerconfiguration
You can see you current CodeSpaces from https://github.com/codespaces This follows the well known GitHub standard, that you access personal information from global URLs - when you are logged in:
https://github.com/issues
https://github.com/settings
https://github.com/notifications
https://github.com/codespaces
Create a new CodeSpace on this repo
- 👉 You go to
Codepanel, hit theCodebutton, Select theCodeSpacetab and then create a CodeSpace 👈
When the CodeSpace is done building you'll see a full fledged IDE environment - it look like the one we explored earlier in the web based editor, only this time you have a genuine linux terminal in the bottom - as if your were on your own machine.
- 👉 run a few familiar commands;
ls,gh,env,cat R<TAB>,git log,azanddocker run hello-world👈
It feels like home eh? Even tab-completion, git, docker, gh is pre-installed. Well the Azure CLI az wasn't installed, but everything else was there.
Let's imagine that we're a development team who agrees that:
👮♀️ You must only make changes that are related to an issue.
👮♀️ Each issue must have its own dedicated development branch.
👮♀️ Work can only be added to the master branch through pull-requests.
If these are rules we should make it easy to follow them.
Now consider, that this issue you're looking at now - #4 instructs you to configure the CodeSpace in a way that ensures that.
- The
azCLI must be pre-installed - The GitLens VS Code extension by Kraken must be installed
- A
.gitconfigfile must be added in the root of the repo, and it must become active
Let's do all this! it's easy!
- 👉 In the CodeSpace go to the terminal and run the command listed below: 👈
gh issue develop 4 --checkout- 👉 In the command palette find the command that will Add Dev Container configuration 👈
- 👉 In the list find and install the Azure CLI 👈
- 👉 In the extension list find and add GitLens, Copilot and Copilot Chat to the Dev Container configuration 👈
- 👉 Add the line listed below as the second-to-last line in the configuration - just before the last closing bracket
}⚠️ remember to add a comma,after the closing bracket above 👈
"postCreateCommand": "git config --local --get include.path | grep -e ../.gitconfig || git config --local --add include.path ../.gitconfig"...and finally
- 👉 Add a new file
.gitconfigin the root of the repo and let it contain the following: 👈
.gitconf file
[core]
editor = nano
[push]
default = current
[alias]
undo-commit = reset --soft HEAD^
addremove = add -A
recommit = commit -C HEAD --amend
co = checkout
st = status
root = rev-parse --show-toplevel
tree = log --graph --full-history --all --color --date=short --pretty=format:\"%Cred%x09%h %Creset%ad%Cblue%d %Creset %s %C(bold)(%an)%Creset\"
backward = checkout HEAD^1
forward = !git checkout $(git log --all --ancestry-path ^HEAD --format=format:%H | tail -n 1)You may want to test the new Dev Container configuration before you commit it?
- 👉 In the command palette find the command that will Rebuild Dev Container configuration 👈
- 👉 Perform some tests - a few ones are suggested below 👈
From the terminal test the following commands
git config --list --show-origin
git tree
azOpen the workflow .yml you created earlier and see that is gives you info about who committed it
Open the .gitconfig file you created - invoke the CoPilot Chat. Ask it to "Add the most commonly used aliases, but don't delete or overwrite any existing settings"
- 👉
add,commit -m "related to #4"andpushthe development branch branch 👈 - 👉 Create a pull request run:
gh pr create --fill👈 - 👉 Run
gh browseand finish the pull request from the web 👈 - 👉 Come back to the CodeSpace and run the commands listed below: 👈
git co master
git pull
git branch -d 4
# After you've typed '4' use <TAB> to complete the branch name