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
.devcontainer configuration
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
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.
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
az CLI must be pre-installed
- The GitLens VS Code extension by Kraken must be installed
- A
.gitconfig file must be added in the root of the repo, and it must become active
Let's do all this! it's easy!
gh issue develop 4 --checkout
"postCreateCommand": "git config --local --get include.path | grep -e ../.gitconfig || git config --local --add include.path ../.gitconfig"
...and finally
.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?
From the terminal test the following commands
git config --list --show-origin
git tree
az
Open 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"
git co master
git pull
git branch -d 4
# After you've typed '4' use <TAB> to complete the branch name
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:
.devcontainerconfigurationYou 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
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.
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
azwasn'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
masterbranch 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.
azCLI must be pre-installed.gitconfigfile must be added in the root of the repo, and it must become activeLet's do all this! it's easy!
},after the closing bracket above 👈...and finally
.gitconfigin the root of the repo and let it contain the following: 👈.gitconffileYou may want to test the new Dev Container configuration before you commit it?
From the terminal test the following commands
Open the workflow
.ymlyou created earlier and see that is gives you info about who committed itOpen the
.gitconfigfile 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 👈gh pr create --fill👈gh browseand finish the pull request from the web 👈git co master git pull git branch -d 4 # After you've typed '4' use <TAB> to complete the branch name