Questions and notes from workshop day 1

Icebreakers

How do you use computers in your work?

Any horror stories of computer work?

Who has been in a live stream course before?

Any questions about the workshop or this document?

Motivation for Git

https://coderefinery.github.io/git-intro/motivation/

What possible problems do you see with the version control solution at https://coderefinery.github.io/git-intro/motivation/?

  1. Is there a reason to choose for instance gitlab instead of github or bitbucket? Any nice comparison on the git repositories?

    • some organizations choose gitlab since the community edition is open source and can be self-hosted without licensing fees.
      • So you can say that is closer to FAIR principles?
        • well, depending on the sensitivity of the code and data, it can be an issue to host code outside of the organization or the country
        • but to make code FAIR (especially findable, accessible), neither of those repositories may be persistent enough (more next week)
    • github is currently the largest service in this space and many choose it for its visibility and integrations with other services (such as Zenodo, to be discussed next week)
  2. Can we do this "blame" (better name: "annotate") also on the command line?

    • tomorrow we will use this feature in an exercise. very useful functionality to figure out when exactly a change has been introduced

Git basics

https://coderefinery.github.io/git-intro/basics/

  1. Is there documentation on how to contribute in a project? since everyone has his own point of view and in addition what if you input may change the results of another part of the code.

    • more about it on Thursday but this is what we plan to discuss: https://coderefinery.github.io/git-collaborative/contributing/
      • thanks
  2. What is a fork?

    • It is a copy of a repository (with all commits and branches, more about those later) and the copy stays on GitHub but is copied typically into your namespace.
  3. Working on different ''github''-ed projects simultaneously, do I store locally all of them, hence using my own local memory?

    • yes, you typically clone (copy) them to your computer and then you have full copies on your computer and commits that you record, are first recorded on your computer and only later published (pushed) to github. This way you also have backup of the projects.
      • then, it means the coding/development work can be done locally, and need an internet connection only when I need to commit the changes?
        • yes, you can do development offline and push changes to github when you have internet connection
  4. Can you zoom in?

    • still small
      • do you have Twitch in theater mode? (hides all the rest and focuses on the screen share in the right aspect)
        • it's in the theatre mode, but we're watching on a big screen. anyway. it's better than it was :)
  5. Are you using command prompt or Git Bash?

    • MacOS terminal. MacOS has git by default
  6. I made a mistake and i have created a .git file in workshop. How do I remove it?

    • At this stage, I would just delete it with the file browser and start again from scratch. If you are familiar with the terminal you can use commands such as "rm -r .git"
  7. How do you see hints in git bash?

    • we have something here: https://coderefinery.github.io/git-intro/customizing/
    • In my gitbash just using the key "tab" is enough, but maybe there's a better way?
  8. Can you change your screen format? It kinda looks like it is in "phone mode" as it is only taking up 1/3 of the screen? I have hidden everything else...

  1. I am unable to access the live stream .

    • https://twitch.tv/coderefinery - this doesn't work?
    • The stream is not loading in Firefox (Linux), have you encountered this before?
    • I am running firefox on linux and i have no problems.
  2. Why two steps of "stage" and "commit"? What is the main purpose and perhaps the reason behind this setting?

    • one motivation is discussed here: https://coderefinery.github.io/git-intro/staging-area/
    • in short: later it can help create well-defined commits (not too large, not too small)
    • but it is possible and absolutely fine to commit directly at the beginning and not worry about staging when starting with Git
      • So can I say it's still a good practice to stage first? And you can always make several stages before commiting, correct? Also can you comment when staging?
  3. Shouldn't the commit header always be in imperative?

    • Common practice but different people can do different things.
  4. i work mainly through python on a server. can i connect to my git through that server? (essentially double ssh connection - once to the server and once to git?)

    • You can ssh to server and run git from command line (that's what many do). git can ssh-connect to Github from there. Is this what you mean?
      • yes i think so. think i just need to try it :) thank you!
        • Could you please run an example on that?
          • you could create a SSH keypair on the server and upload the public key to GitHub and then you can git clone to the server the same way you would clone to your laptop. You can then push changes from the server and pull them to the laptop and vice versa. We will learn this on Thursday.
  5. I get this warning whenever I add a text file created using nano. warning: in the working copy of 'instructions.txt', LF will be replaced by CRLF the next time Git touches it

    • You can ignore this for now
    • This should solve it: git config --global core.autocrlf false
  6. can we go a bit slower

    • thank you for feedback, also poll below:
  7. Is the commit message the same thing shown in the "Blame" menu?

    • yes, on git annotate/"blame" the relevant commit hash and message (first line) is on the left

How is the speed so far for all (add an "o")?

  1. When doing git commit [Ubuntu, bash, Vim] , the text entered begins in bold yellow, but then shifts to normal white. Why is that? A maximum length of a commit message?

    • Yeah, context-aware highlighting warning about recommended max length.
      • Does it mean I can't enter a msg of a greater length? Why is there a max length for commit messages?
        • Most tools work best by displaying a short message. But if you add another line (\n if used with the -m "short commit message\nMore context here..." flag or just a new line if you write the message in your editor) you can add more context.
      • also once we start browsing commits on GitHub it becomes clearer why it's good if the first line is not too long
  2. What is the purpose of -m?

    • it refers to 'message'
  3. Can we edit the commit message after commit. May be for better documentation?

    • yes, also possible exercise tomorrow: https://coderefinery.github.io/git-intro/recovering/ (git commit --amend, note that this modifies the history)
  4. how do you get the terminal input commands as is shown on screen (lowest pannel)?

    • This thing but there are others that do it, too (maybe another one is being used now): https://github.com/rkdarst/prompt-log/
  5. Is there a git GUI?

    • Yes, many, including many editors have git stuff integrated.
    • https://coderefinery.github.io/git-intro/basics/#graphical-user-interfaces
  6. I missed the first step how did you create the txt file, what was the first command? ___ something and ingridients.txt

    • nano file.txt ?
    • vi file.txt
    • Thank you, I get a file like this: .instructions.txt.swp (+1), what could be wrong?
      • No worries. It's just a temporal file created by Vim, while you have it opened. Once you close the file opened via Vim, the *.swp will disappear. Thanks, how do I close it :D (+1) and how do we add text to it?:
    • 'i' to start editing, 'Esc' to finish editing, ':' to enter commands, which could be, e.g. 'w' to save changes, 'q' to exit, 'q!' to exit without saving changes. Never ever use 'Ctrl + S' to save the file! You'll freeze Vim :D I strongly encourage to read Vim documentation, Vim is a cool tool ;)
      • You should edit the files with your preferred editor, be it vi, nano, emacs, ...
    • When I click 'i' I get "Mark not set"?
    • If I a try 'q' I get "recording @q"?
      • vi is not an easy editor to get started (I write this as vi-user) so to get started with any editor, I recommend vscode or nano
  7. Is there some kind of cheat sheet with all git commands?

    • git reference in this lesson: https://coderefinery.github.io/git-intro/reference/
    • long cheatsheet made by instructors: https://aaltoscicomp.github.io/cheatsheets/git-the-way-you-need-it-cheatsheet.pdf
  8. After doing git init, I thought git knows the diretory/repo. However, why we need to do git add for each of the files. Is there any way to add all files to git repo with a single command

    • It's two seperate processes because the init is creating the repository on your local machine. Then you add files to the repository. When you change files, you need to add them again, but you don't need to init again.
      • This is so that you can be flexible about what to include in he commit. Yoy may chose to modify files but maybe you are not ready to include them in the next snapshop/commit.
        • If you want to start tracking/include in the next commit all files and sub-directories, you may do git add . (please notice the dot, which means all content of this directory)
  9. Can one create nested git repos?

    • yes, with git submodules you can have one git repository (submodule) inside another
    • example: https://github.com/coderefinery/coderefinery.org ("uikit" has different color there, it is a submodule)
    • or other way to to something similar is git subtree
  10. I tried to do the git commit but I get the following message ->

*** Please tell me who you are.

Run
  1. I don't have the instructions.txt etc. The instructor told it was not necessary to type along.

    • You can scroll up and see and try it now
  2. I have an existing git repository (gui.recentrepo= ...), but I do not want to use that. How do I change to a different and make a new repository?

    • You could create a new folder and git init in there.
  3. What is the meaning of stage in git

    • We will talk more
      • Staging files/modifications means telling git that they should be included in the next commit.
    • see also 12)
  4. Im in vim entering instructions how do I exit and save?

    • hit Esc to exit edit mode and enter command mode
    • type :wq (for saving and quitting) + Enter

Exercise: recording changes

https://coderefinery.github.io/git-intro/basics/#exercise-record-changes

:::info

Questions about exercises continue here:

  1. When I write git add instructions.txt, results "fatal: pathspec "instructions.txt" did not match any file

    • Make śure you have the instructions.txt file created in the directory. or check the file name if it is correct. Thanks
  2. Can I git add two files at the same time?

    • Yes, you can add two files at the same time. "git add instructions.txt ingredients.txt"
  3. Getting this error while using git diff <hash> -- -bash: syntax error near unexpected token `newline'

    • There may be extra characters in the filename (like "<" or ">"). Can you copy-paste the whole command you used here? e.g. git diff filename.txt
    • git diff <hash>
      • the <hash should be the hash code of a commit which is compared to the current state of the code, such as "345rsdaf". You can see commit codes with git log
      • Fixed it. Thanks :)
  4. How do I leave the git commit window when I added my comments?

    • Possibly the editor is vi since you maybe did not change this to your own editor
    • If this is vim type escape, followed by ":wq" and then enter
    • this is how you can configure your favorite editor for this: https://coderefinery.github.io/installation/shell-and-git/#step-2-setting-an-editor
  5. Can you share the zoom link for this course?

    • We don't have a separate Zoom for this - some partners might if they have local support.
  6. what does "(HEAD -> master)" mean? this is next to my most recent commit when looking at git log

    • we will clarify the naming of "HEAD" in a moment. it is borrowed from "recorder heads" (in old school tape recorders) and refers to the position where new commits will be recorded. Later we will see that this means that we are currently on the "master" branch (later we will learn how to create and work with additional branches)
      • 👌 thanks!
  7. I got stuck after git diff command, I have a list of differences and (END) at the end. How do I get back?

    • A new window shows this? What editor are you using? does q or control-c help? I used vi editor, I modified the files, I typed git diff
    • ok, maybe ESC :q! several times to get out?
    • Thanks something of these worked.
  8. when I type git commit -m it returns nothing to commit, working tree clean. so when I try the git -diff nothing has returned

    • You need to introduce some modifications, stage them with git add * (I think it's git add .) and then commit with git commit -m <commit_msg>. You cannot commit if you have no staged changes in your working directory.
    • strangly enough, i did everything as it says. I even add again but it is still says nothing to commit, working tree clean.
  9. What does this line mean, for example "@@ -3,3 +3,4 @@" when git diff? (+1)

    • this particular format informs about which lines have been added and removed. it comes from the unix "diff" and "patch" commands. in the early days of Git and version control, GitHub did not exist yet and some projects were emailing commits to each other and applying changes with the "patch" command and this format then automatically worked for those commands.
  10. When trying to use opendiff as a visual diff tool (command: git difftool --tool=opendiff <hash>), I get the error message "xcode-select: error: tool 'opendiff' requires Xcode, but active developer directory <...> is a command line tools instance".

    • You need Xcode. You can install it via the App Store.
    • xcode-select --install
  11. Does anyone experience very slow git command execution?

    • Hm, that's weird. On what computer are you running?
    • It is resolved now when i change to use git bash prompt. Previously i was using another terminal
      • ah good. indeed for this lesson please follow in git bash on Windows
  12. Every time I git add, I get this message: warning: in the working copy of 'ingredients.txt', LF will be replaced by CRLF the next time Git touches it. Is it something to worry about?

    • for the moment it is safe to ignore it. looking for how you can fix it ...
    • what it means is that Git is unsure about line ending convention between linux and windows but this can be configured.
    • maybe this is the fix? https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings#global-settings-for-line-endings
    • thanks, I will check it later
    • I shared an answer on Twitch, this is answered here: https://stackoverflow.com/questions/5834014/lf-will-be-replaced-by-crlf-in-git-what-is-that-and-is-it-important (provides an option for fixing the error if you are really annoyed by it)
  13. Sorry, so many questions, I can't check if this has been asked already. But why aren't hashes just "counting integers", indeed? Let me know if it's been asked already.

    • Because multiple branches can happen at once, and
    • The hash is uniquely generated based on the content of the repository and , the commit (name of commiter + date). Check Git under the hood for more info.
    • many questions is what we want :-) keep them coming
      • Thanks a lot, I'll have a further look into that!
  14. Various git commands are very slow (latest Git version, using Git Bash on Windows). These commands include log and diff. Do you know what may be the issue, and how it can be resolved?

    • First I've heard of this. Probably we need a local person to take a look and debug
    • Directly use git bash terminal helps (on Windows).
  15. When using the $ git difftool --tool=opendiff <hash> command, I am getting an Xcode error: xcode-select: error: tool 'opendiff' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance ////// What do I do?

    • Realistically: wait for afternoon and ask someone / search the web for solution. (maybe somehere here knows though)
    • see also 41)
  16. I use the $ git difftool --tool=meld 101bd58 command and it works fine, but can I ask to see the diff for a specific file right away?

    • Try giving it that filename as an argument
    • yes $ git difftool --tool=meld 101bd58 instructions.txt woks nicely
  17. I went further down to optional exercises. git difftool --tool=meld <hash> doesn't work me. I have meld installed.

    • what error message do you get?
      • no msg at all: empty output
    • first make sure that there is any difference to show. what do you see with git status or git diff?
      • ah, Ok, there has to be changes :) I'll make sure to have some next time :)
      • Anyways, I don't get why is there only one <hash>. Then, between what do we sick for a difference?
      • git config --global diff.tool meld to use Meld for permanent usage. How to roll back to the diff output into the terminal?
  18. Still trying to create the txt files through git bash?

    • we recommend the "nano" editor as a simple thing that works.
    • nano filename.txt will start editor and make a file with that name
    • Control-x then y will save and exit
  19. why does $git diff show nothing if I am using Notepad++ as my editor but works with nano?

    • maybe this is the problem: https://coderefinery.github.io/installation/shell-and-git/#on-windows-git-log-git-diff-git-branch-or-other-git-commands-show-no-output-at-all
      • please et us know whether this helped
      • Yes, this works! Thanks
      • Correction: It doesn't work when I create the file for the first time, add content, then call $git diff. It works if I already have the file with the content and edit it.
  20. what does diffrenet colors in git diff mean. what is the meaning of red and green lines?

    • red lines got removed, green lines added
  21. why do we need to first use "git add" and then "git commit"; why doesn't the "add" also "commit"? Is it because you may want to have a commit message associated with multiple adds?

    • yes, some motivation for this is discussed here: https://coderefinery.github.io/git-intro/staging-area/
    • bigger picture is that later this may help to not put unrelated changes into the same commit
    • but when starting with Git, it is OK to not worry too much about beautiful commits. better commit too often than not often enough.
  22. When doing exercise optional basic-4, the last step, where I type "git log --stat", it prints the same commits log 24 times... what gives?

    • git log --stat should output a line with the commit <hash>, the name of the commiter and date of the commit, followed by the commit message and the files that have been modified by the commit. I cann't really tell why it's printing the same commit 24 times for you...
      • okay, I ran the command again, and it seems to have calmed down. Now it prints only once. Thanks (:
  23. Can I use git to track xlsx, xls and csv files?

    • It can track, but won't give good diffing and merging. It might be reasonable for small ones, but not for mass data management.
      • but it should work well for csv files
        • any other suggestion to track changes in tabular content?
          • for not too many rows and especially columns, csv works well but I am also curious what other people use
  24. my problem is still not solved, adfter I add the file (base) recipe % git add ingredients.txt (base) user@camputer recipe % git add instructions.txt (base) user@computer recipe % git status On branch master nothing to commit, working tree clean

    • from this it seems the files have not been changed? git add on a file which has no modification will not do anything

Git history and log

https://coderefinery.github.io/git-intro/basics/#git-history-and-log

  1. The top two screens are cut off (+1)

    • I'll point it out to them if they use that extra part
    • They used it already when mentioning where the HEAD was pointing (we cannot see "HEAD -> master")
    • The materials
    • are also cut, please let the instructor know
  2. What is the advantage of using difftool instead of just git diff?

    • Sometimes the graphical view can be useful. I don't use that often but with big or complex files it can help get a better picture.
      • yes, side by side instead of on top of each other. I also like this tool: https://github.com/dandavison/delta
      • thanks!
  3. My branch is named "main" instead of "master". Should I worry about it?

    • New default name, some gits are configured for it, some not.
      • Thanks!
    • you can continue with "main", the rest of the lessons should work without problems
  4. When I made the files instructions, ingredients, etc. and used the git add, git commit commands can that be seen in the git hub account of the user?

    • It is possible to see all the changes but only when you push the repository to GitHub.
    • GitHub will sync all the changes of you local repos. You will be able to see all commits and modifications, just as you can do when using the command lines. The output may look a bit different as it's a graphical interface, and not all commands are supported.
    • tomorrow we will push the changes to github, until then they are only on your computer
      • thanks.
  5. Is is possible to reduce the low end of the male instructor's sound? It's quite booming.

    • Hm. anyone else? sounds good to me (broadcaster).
    • Ok, this is for the Delft workgroup, perhaps poor sound system on our end. If not a common problem, we'll look into it here. Consider resolved.
      • ok, also good here as individual listener
  6. i got the following error: xcode-select: error: tool 'opendiff' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance (sorry, i know this is an instal issue. i thought i had everything sorted)

    • this has been asked few times and I don't have a good solution (sorry linux users here with almost no macOS experience)
      • You may need to restart your terminal after installing Xcode. But if you cannot make it work, I would say just skip the exercise, or look at the differences with git diff, so without using opendiff.
  7. Is only the long-version hash unqiue not the short version?

    • Correct. but git tries to make the short version unique enough by making it longer as you get more commits.
      • The short version is unique as well. Git will use a large enough number of digits in the output to make sure it is unique. But the commits all have a long <hash>, it is just the output that is shortened for better visibility.
  8. I tried to install Xcode in my mac but got message "No Operating Systems available for download"

    • Did you try xcode-select --install?
    • what is the bigger picture of this question? is this to enable visual diff tools?
      • Opendiff is used just to visualize differences in a more appealing way. It is OK to just use git diff and inspect the differences in the prompt.
  9. When I do git init, do I automatically create git repo on my GitHub account or only locally?

    • git init only modifies one directory on your own computer. It's not linked to anything else until you do that (demo tomorrow)
  10. Is there a way to easiy copy/paste hashes in the command line? Manually retyping doesn't seem convenient

    • I have also been wondering this. It seems very awkward copying from the Git command line
    • you don't have to use th full hash I think. just enough of it so that it's unique. (minmum 4 chars it seems)
    • also on the command line you can select with mouse and paste (how depends however on the terminal. on my computer I select with left mouse and paste clicking both buttons)
    • in practice you will almost never need to paste or even copy the entire hash and we will rather refer to commits by branch names (later) or tags (later)
    • use shift + insert to paste in command
  11. The screen seems to be cut from the sides in the stream. Is it possible to fix it so we see the right end of the screen?

    • I think it might be to save space, I'll ask when possible.
  12. How do I create a .gitignore file?

    • It's a text file, so nano or the other editors you have used works.
  13. Do you usually version control the .gitignore and .gitconfig files?

    • .gitignore: yes!
    • .gitconfig: this is per-user, so not tracked in most repos (but someone might use git for it in its own repo!)
      • but there is also a .git/config (to overrride the global config)
      • is that one version controlled?
  14. btw. Any one struggling with diff tools who is familiar with vim may use git difftool --tool=vimdiff. You can also use vscode.

    • also have a look at https://github.com/dandavison/delta if you are interested in improving/customizing the rendering in the terminal
      • That is for diff though, not difftool (If I'm not mistaken). But good suggestion! Might require some config though.
  15. Is it possible to install FileMerge (opendiff) on mac without instsalling the full XCode? It takes too much space.

    • sorry I am not sure
    • I did some Googling but it does not seem to be any easy solution. I am not sure it's worth the effort for the purpose of this exercise.
    • We installed Meld for MacOSX - Instructions to configure git to use it are also on the linked website.
  16. Is "Compiled and generated files are not committed to version control" automatically configured? Does it mean I can find all the compiled and generated file names in .gitignore?

    • correct!
    • but it requires somebody to creating that .gitignore file if you are the first person in that git repository
  17. Is there any way to edit my git repo remotely, e.g. right on github website or so? For instance, for LaTeX, there are sources like Overleaf

    • GitHub / GitLab do have interactive editors good for simple things
    • Overleaf has (or had) a git repo connected to it you could clone and push from
    • Basically search what you need and you might find a way to connect
      • do you mean to search in the web? :) yes.
  18. Your shared windows doesn't fit the stream resolution size.

    • thanks for reporting!
  19. m1 m2 stands for master 1 etc.. or for merged 1?

    • in current figure I guess master/main
    • in that figure they stand for merge commits (to make it readable, imagine instead 40 character long identifiers)
      • merge commits combine work from two parent commits (two branches)
  20. Which changes are commited straight in the master branch?

    • in this figure m[1-4] are commited straight to master
      • I mean semanticaly
        • can you please expand what you mean by semantically?
  21. So. a branch is a copy of a commit by another person?

    • I find it useful to imagine a branch as a "sticky note" that sticks to a commit. But another way to look at a branch is to follow the "ancestors" of commits which forms a graph/ development line
    • but it does not take several persons. as a single person I use and create branches. we always have at least one branch, typically "main" or "master"
  22. Would it be a useful way to attach branches to software used? For example, I use python to do the main work of estimating things and stata to anaylize the results. would it be useful to create a branch for the stata part and have as main the python part?

    • Hm. I think trying to keep one standard branch with everything is most convenient: the things you might work on at one time, maybe in different sub-directories. (if I get to a point when I need to switch branches as part of daily work, that can start to get annoying)
    • branches are often used for new features that still need testing before being merged
    • or they are used as soon as more people are working on the project so that they can develop and test their code without interfering with each other until they decide to combine their work
  23. No need to type this command for git config. They can be copied from the website. +1

  24. i cannot type anymore in gitbash: says (END) after doing git log --stat. How do i continue?

    • does q work to exit?
    • yes thanks!
  25. What's the difference between git graph and git log --oneline?

    • giti graph is an alias that we have defined for git log with some options: git log --all --graph --decorate --oneline. The oneline means show one line per commit, all means show all branches, decorate is some output prettifier, graph will add lines between a commit and its parent(s).
  26. I really like the command history in the separate terminal window. That's very helpful. How do you do that?

    • you can find different things that do it, here is one: https://github.com/rkdarst/prompt-log/
      • is it not just tracking history file? smth like watch -d -n 3 'cat <history file | tail -n 10'?
        • in essence yes, but it is a bit more sophisticated since you want to show commands before they finished/exited
    • nice, thanks!
  27. Would git warn if you use some of the "control" terms (e.g. push) for giving alias names?

    • I think it wouldn't let you do that.
      • Good to know!
    • The reason: someone could make an alias and then all kinds of scripts and automation might break! Better to keep the basics consistent
  28. When we create a new branch, will it also inherit all of the files from the parent branch? Can we just pick certain files to be inherited?

    • when you make a new branch, it always starts from the current commit - including all files there.
      • and including all parent commits
    • Just curious, can you create branch with blank state so without any files and history?
  29. git graph does not work for me. it tells me: git: 'graph' is not a git command. See 'git --help'. (+1)

    • You need to define the alias so that it works: git config --global alias.graph "log --all --graph --decorate --oneline"
    • were you able to run the command for setting up the alias? git config --global alias.graph "log --all --graph --decorate --oneline" ok now it works. thank you
  30. What is the difference between git branch <branch-name> and git checkout -b <branch-name>? Are they the same or is it a good practice to favor one over the other?

    • the first makes branch but doesn't switch to it. the second makes+switches. Depends on what you need, I use both in different cases.
    • The checkout command can be used to checkout an arbitrary commit without switching branch. But in this use-case they do the same thing.
    • To add to the options there is also git switch -c branch_name ('-c' for "create")... Focus on getting proficient with one option.
  31. How to remove commit? Basically, how to roll back? (+1)

    • The "undoing and recovering" optional episode talks about this some.
    • There are ways to do this, it would only be recommended if you haven't pushed to share the code yet (but in that case, completely OK!).
      • Let me clarify : I made some change, which I considered useless, and I removed it and saved the file. However, the date of the last edit has changed, and git considers this as a file change. Thus, I have to git add, git commit, whereas there are actually no changes to the files. So, my question was to fix this? For instance, how to jump from stage <hash 1> to an earlier stage <hash 2>, removing everything in between?
        • git looks at content changes and not at date of change but answering your question: if you only wanted to see how the file was at hash1, then I would create a branch pointing at hash1 and go to that branch and have a look: git checkout -b somebranch hash1. If you wanted to change some file and bring it to the state hash1 and continue working on it on your current branch, you want git checkout somefile hash1
  32. What is it better when working in different servers. For example, there is a github repo stored in 3 different servers, two in computer clusters, and one locally. The ones in the compter clusters can be accessed by several users, bbut most of the times it's a single person working on the repo and pushing the changes to the main branch. Is it better to create different branches, or to keep working on each server as "main"?

    • I would recommend to agree on where the central server is and to work on that one with branches if needed. using multiple servers can be good for backup and can be useful if you want one server to be public and another one private for the unpublished stuff. but too many servers can also become confusing in terms of where is the issue tracking and where is the "main code". In short: fewer servers, work with branches
  33. Is this also the appropriate time to do the optional exercises down at the bottom of the page, or should those be saved for later?

    • Depends on how much time you have - I'll ask.
      • I mean, will we be given more time for optional exercises later on, or is this now or never type of thing? Thank you!
    • I recommend you to go ahead with the optional exercises if you have time. In my understanding we don't plan to do the optional exercise all together but will rather move on to other exercises.
      • Great, thank you!
  34. I accidently created the less-salt branch while in the experiment branch. How do i remove this branch?

    • git branch --delete less-salt
  35. You can have branches locally even if you have a linear history on the remote repo, so branches are still useful (right?)

    • exactly. some projects look like they have only one branch on github but then locally developers have sometimes many for their own work until they merge their changes to that one branch
  36. How do you remove git aliases?

    • There probably is a dedicated command but you can git config --global --edit and remove them from the file.
    • new aliases get added to .gitconfig in your home folder and you can also edit them directly there (but the above advice is nicer)
  37. I added the README.md file in the master branch but then when I run #git graph command I dont see what expected. I just see the same as before, but with a new line in the top (* 637d1e9 (HEAD -> master) added README.md file). Below, it remainssame as before.

    • and the other two branches do not show up there?

    • It appears both but not separated as in the solution you gave us.

      • 637d1e9 (HEAD -> master) added README.md file
      • ddda9e2 Less amount of salt | * c9a90a0 (experiment) reduce amount of cilantro | * cc16907 let us try with some cilantro |/
      • b87bd73 (less-salt) deleted old_file.txt
    • Looks like the branches and commits somehow got mixed up. That's OK, it happens a lot! I would try again, and when we go to the next part there's something to do that lets you recover and get back to the exercise.

      • is indeed not a problem don't worry, we have steps later that you can take if you want to "reset everything" in case you want to follow along
        • correction after more careful read: experiment branch looks good, looks like salt was reduced on master and not on "less-salt" branch
        • I could suggest a recovery but would need to see more of the git graph history
  38. how do i create README.md file?

    • with the editor of your choice, e.g. "nano": nano README.md
  39. How to delete an added (not commited) file?

    • try first git status and it will also give you hints on how you can unstage the file.
      • (use "git restore --staged <file>..." to unstage)
  40. how do I know if i added a branch in the branch experiment or in the master?

    • git status shows the branch you are currently on. git graph wolud, too (and also show recent commits).
  41. When merging branches, is there a way to check conflicts that prevent the merging? I cannot merge? (automatic merge failed. fix conflicts ant then commit the results is what I get). I am using notepad++ for editing I might have unwilling saved-changed files.. git

    • you want to know whether it would conflict before trying the merge and finding out that it might conflict?
    • ah! try git diff (it will show you the conflict then) and git status (it will list conflicting files). you can also lean back and wait for conflict resolution episode that is coming up later today where we discuss this. you can then open the conflicting files in your editor and look for conflict markers.
      • preview: https://coderefinery.github.io/git-intro/conflicts/ Thanks!! Yes I just realized that It will be in the content later ^^
  42. what time is exercise until?

    • xx:20 (but in my understanding including a 10 min break)
  43. Keep receiving this error in the exercise, "ingredients.txt Please commit your changes or stash them before you switch branches. Aborting" How do I fix this? - can't move to less-salt branch

    • git add and git commit those files. Or if you don't want those changes, you can git checkout to undo the changes.
  44. I added and commited a file to master branch. Is there a way of going back one commit?

    • yes, see here: https://coderefinery.github.io/git-intro/recovering/#rewinding-branches-modifies-history (we will come back to this tomorrow)
    • if I wanted to get rid of all commits that came after hash1, you can do (be careful with this command!): git reset --hard hash1
  45. error warning the working copy of 'README.md', LF will be replaced by CRLF the next time Git touches it. What does this mean? - it is about different treatment of line endings on windows and linux - git config --global core.autocrlf false

  46. Can you create a branch inside a branch? - yes! from any commit, and it can become a complex network. - but please note that branches are like sticky notes to commits, they refer to commits, not to other branches

  47. When I merge, it says "please enter a commit message", but how do I do that? - It probably is starting an editor that says that? You can type something and then save, a lot like how we have edited other files. - if this is an unfamiliar editor, you can configure it here: https://coderefinery.github.io/installation/shell-and-git/#step-2-setting-an-editor > This works, thanks!!

  48. Can git/git hub create a image scheme such as the one in the exercise m1 m2 etc... so to make clear what is happening?

    • If you go to "insights" there is a network view
    • git graph is what I normally use for this type of view for looking locally. There are other programs that do it, too. Where is insights? On GitHub, right-most on the top bar: Code, Issues, ..., Security, Insights.
    • example: https://github.com/coderefinery/recipe-before-merge/network
  49. ERROR $ git merge less-salt error: Your local changes to the following files would be overwritten by merge: README.md Merge with strategy ort failed.

    • before merging makes sure you have no uncommitted changes. before merging do git status.

Exercise: creating branches

https://coderefinery.github.io/git-intro/branches/#exercise-create-and-commit-to-branches

:::info

  1. ERROR git merge less-salt Auto-merging ingredients.txt CONFLICT (content): Merge conflict in ingredients.txt Automatic merge failed; fix conflicts and then commit the result.

    • We will show how to solve conflicts after the merge branches part. This occured because you changed the same part of the file in both branches.
  2. Wait, are we supposed to be merging already? (+1) - not yet (as far as I understood) but some learners/groups seem to have gone ahead - I believe some confusion was raised by the suggestion to also go on with the optional exercises

    • aha, oops my fault that advice :-) to be clearer: merging is not expected yet but I encouraged to look at optional exercises for those who have time
    • No worries really, just sharing we had the same misunderstanding here in the room (Germany)
    • My fault (diana) for missleading you. But if you have been working with Git for a while, it is fine if you did the merge and the optional exercise.
  3. What is the difference between "rm" and "git rm"?

    • rm will remove it using the terminal but Git will not know that we wanted to remove it. with git status Git will then point out that the file is gone but unsure whether we wanted to remove it. with "git rm" we remove the file from the directory but at the same time tell Git that we want this file to be removed in the next commit and Git will stage this change for the next commit - Use rm for untracked files (files Git does not know about), and git rm for files that have been staged or commited before (=files that Git knows about).
  4. I encountered this behavior that when I merged the branch experiment to master it didn't put any message on the the commit, nor did it require me to put a message. Any idea why did it happen?

    • I think it can do this when there are no conflicts - automatically do everything.
    • depending on the git configuration, if there are no conflicts, it either creates the merge commit automatically or opens an editor for you to possibly modify it.
  5. What senarios should we consider rebasing instead of merging?

    • When you want to keep the history linear and don't care about re-writing. Often used for organizing internal work before sharing, not so good for shared work (since history gets inconsistent)
    • Wouldn't it be a bit counter-purposeful for tracking changes? Because all the branching histories will be gone? For this reason I don't see the benefit of using rebasing?

Merging branches

https://coderefinery.github.io/git-intro/branches/#merging-branches

If you got a very different result in the previous exercise and want to continue typing, you can follow the recovery steps but skip if it lookeusingd like expected.

  1. I have got "Merge made by the 'ort' strategy" instead of recursive. What is the difference?

    • For parctical pruposes it doesnt' matter for this course - different default in newer git, I think.
    • Basically git has different algorithms for figuring out the merge, what we do is too simple for it to matter. (I've never had to figure out)
  2. What is the meaning of the line colours after mering the branches? (the green and red lines)

    • where do you see them? in which command or output?
      • in the output, in the terminal, in the graph after merging the branches
      • ah I guess it tries to give the different branches different colors? (checking on my side ...)
        • yes it gives them random colors to make distinguishing easier - I also have blue and purple / |
  3. But isn't this already part of the exercises we were supposed to do before hh:20?

    • sorry no exercise went only until creating the 3 branches. sorry we did not make this clearer but the good side is that now you can lean back and watch the instructors do it.
      • :-)
  4. Can we merge two branches other than master? e.g. experiment with less-salt?

    • yes!
    • git merge somebranch merges "somebranch" into my current branch, whatever my current branch is.
      • Perfect!
    • A hint that has helped me: any git command will only modify the current branch.
      • yes, any "git branch" or "git rebase" (but not "git branch --delete")
  5. Can I do without "checkout", since we have "switch"?

    • Yes. We still have older commands to make sure the examples can work for everyone, but we are almost to the point we can update.
  6. Generally speaking which changes should stay on master branch?

    • if it is just me and I am starting with Git: everything on master or main branch
    • later once I start using more branches, I merge to master the "good parts" and don't merge the experiments that did not work out
    • if I work with many people, we often agree that on "master" or "main" we keep the working code/project
    • some projects put published code on "master" and keep unpublished on other branches
  7. I got stuck and tried to run the commands instructed if one got stuck: the command git checkout experiment gives error: "error: pathspec 'experiment' did not match any file(s) known to git" Same with less-salt. What is wrong?

    • the experiment branch doesn't exist. Something must have gone wrong in the exercise - try the recovery for now, and you can try again in the afternoon.
    • the reason why this failed (sorry!) was that I introduced a mistake in the recovery steps. They are reordered now and now it should work. Sorry for confusion.
    • https://github.com/coderefinery/git-intro/commit/9cd66ae92fcf8fbce742537d8fff099174e85715
  8. What if you want to revert to a version of the file that was in a deleted branch?

    • In cases we are doing, the commits are still in history (since the branches have been merged).
    • git graph can help you find the commit and then checkout from it (the whole version, or just that file. More on this later).
    • deleting merged branches is safe since this does not remove commits
  9. Why different colors in git graph after merging experiment with master?

    • colors of the lines don't have any special meaning - just to tell them apart. Is that the question?
      • Yes and No, I guess its also about differentiating specific commits in different branches that were merged (I guess)
  10. The command "Git graph" gives me: git: 'graph' is not a git command. See 'git --help'.

    • do git config --global alias.graph "log --all --graph --decorate --oneline" first to define the command
  11. How often should we push changes when working in a collaborative github repo. Seems like so far we have only worked locally, swiching between branches and staging changes only done in a single server?

    • yes so far everything is on our own computer. on Thursday we practice collaboration. you want to push whenever you want to either back up your work to the other server or if you want others to see your change.
  12. A general question at this point that I should have asked earlier. Git gives us a log of the history of the project but it does not save the file history, does it?

    • Every file history is actually saved - you can always see and revert to any committed version.
      • even files that you later remove with "git rm" can then be found in the history pre-removal
  13. I encountered this behavior that when I merged the branch experiment to master it didn't put any message on the the commit, nor did it require me to put a message. Any idea why did it happen?

    • depends on git configuration whether it lets you then edit the commit message or not
  14. Is is good practice to use branches to work in a local repo, stored in a sever where serveral users have access to? Or is it better for a single user to work in a branch of local repo that only he/she has access to?

    • Probably one repo per user. If multiple users share a repo on different branches, only one person can work at a time and it's really easy to step on each other.
      • (same person as --^) I have some projects with multiple peolpe editing the same. It works if you don't edit much, but definitely not ideal - it eventually breaks.
      • Adding to that, the filesystem is only in one state at a time. So, if you share a repo and checkout a branch, the files in the director will be switched out. That might give unexpected behaviour if used together with others. (At least that's my understanding)
      • You can of course have a shared main repo (there's probably a technical name for that, [edit: bare repo]) on a shared server and then people simply push/pull to/from that. There are special repos that just do that job and nothing else so you can't mess it up. Sites like github, gitlab etc. would probably use something like that in the background.
        • git init --bare test_repo.git
  15. What is your opinion on rebasing a feature branch regularly onto master to avoid many merge conflicts for a feature whose development takes a lot of time?

    • good idea, better to get those rebase conflicts taken care of early.
    • but it's possible that rebasing might be a lot of work if it gets to a lot of conflicts.
    • adding to this: rebase is not a free ticket out of a conflict. if a change would conflict in a merge, it will also conflict in a rebase. rebase can be useful to make review easier and to make it easier to combine/squash commits.
  16. A tag then refers to the whole repository, not a particular file?

    • Yes, the whole repository
      • The tag refers to a particular commit, so 1 snapshot of the repository.
    • it's like a sticky note next to a commit
  17. The issue with the tag is the name of the tag (it was called noble-2021 and not nobel-2021)

  1. Is there a benefit to using Git from Terminal/command line compared to GitHub Desktop or other GUI alternatives?

    • Sometimes useful, but for routine work both can do what you need.
    • Mainly we prefer the terminal for teaching, since it's the base that works for everyone.
      • that is clear, thanks!
    • and once we have understanding of what is really happening, it becomes easier and more predictable to use other tools that hide the details
  2. typo!!!

    • thanks for the catch!
  3. What was the purpose of -a when creating the tag?

    • -a is for annotate
      • advantage of annotated tags compared to "lightweight" tags is that they can carry additional metadata such as who created the tag
  4. Is it possible to "wild-card" search for tags?

    • git tag | grep somepattern is one way (here using the fact that we "pipe" the output of git tag into the shell command grep that can filter patterns)
    • What I meant was to search with wild-card for a created tag. I tried grep mytag* | git show and it somehow worked! Although it still throw error zsh: no matches found: mytag*.
    • You can do git tag -l "v1*" for example to search for all tags that match the v1* pattern.
  5. Is it possible to change the annotation of an existing tag?

    • yes it is possible. it is also possible to remove or move tags but we try to never move or remove tags which refer to published releases since this would be confusing for the humans and codes that use those releases.

Conflict resolution

https://coderefinery.github.io/git-intro/conflicts/

  1. What if you need to resolve a conflict and git asks you to do that in vi???

    • Our "basic resolution" uses an editor, if you set your editor to something else it will use that (like nano for us)
    • vi is awesome! Just use the 'i' key to start typing in it. Once you finish editing the file use ':wq' to save changes and exit. Although of course you can change your default editor for git by changing the core.editor key in the git global config file (e.g. git config --global core.editor "code --wait" to set up VSCode as the default editor)
    • It should give you a warning and let you open files yourself, though, using the tool you want.
    • It only gets better from here, but if you are slow and steady it should be OK
  2. git: 'graph' is not a git command. See 'git --help'. - Add the "git graph" alias, copy/paste command from here: https://coderefinery.github.io/git-intro/reference/ - git config --global alias.graph "log --all --graph --decorate --oneline" - Thanks. It works now.

  3. If I'm stuck at "hint: Waiting for your editor to close the file...", is there anything else to do than close and start again?

    • Hm. Did a new window/tab open in some other editor you have configured? It's waiting for that
    • to save and close.
      • no unfortunately. I think I closed it but then this message appeared
    • ok, hm... I think there probably is something open. Probably. Does Control-C cancel it? (it might get in a bad state)
      • Thanks for helping, but ctrl + C doesn't do anything
      • It looks like this on my BASH and no other window open: name@name MINGW64 ~/Documents/Name/code1/recipe (like-cilantro) $ git commit hint: Waiting for your editor to close the file...
    • What do you get if you run git config --global core.editor
      • I can't run anything, it's just stuck there
        • If it's really stuck on the command line then ctrl-C or ctrl-D should stop it I think. -thanks, maybe I will start again, when running the code you suggested it just gives 'nano' as output and nothing happens to the frozen one :D
        • Ok, that's good, that means the editor is configured as nano. If you run jobs do you get any result? (Just to check that nano isn't running in tha background.) -nope, nothing
        • So, did nano (a command line texteditor) open when you ran the command and then it got stuck when you closed it, or did it get stuck immediately? If it didn't open, check that nano is installed nano --version.
        • You might try 1. opening a new terminal, 2. going to the directory, 3. running: git status to make sure that the files are still staged and then 4. run git commit again. I tried to reproduce the error by killing my editor, and that seemed to work to recover. Though, my terminal didn't hang. -Ah yes, first it opened, I wrote the description for my commit and closed it. Then it got stuck like this.
          • But you were able to run commands somehow right? what happedn if you run git commit -m 'message'. THat shouldn't reuqire any editor. -I opened a new bash cmd for running commands. On the frozen window I could not run and now I have restarted computer so I can't answer to you sorry :D would be nice to know what caused this but maybe it's hard to get to the bottom of this.
        • It's probably in the interaction between the nano editor and git (maybe the process handling of the shell plays a minor part as well). I'm not too familiar with nano in particular. But I think, that if nano managed to save the file, git should be happy and "make the commit" with the message. If nano quit without saving the file, git should abort the commit. So probably either the nano process ended up not exiting, maybe by ending up as a background process (that's why I askd you to run jobs) or it didn't exit successfully in whatever way git expects (I'd have to think about how to debug that). The currious thing is why you got back to the command line and the prompt froze. I'm not sure about that. If I were you, I'd try to repeat what you did a few times and see if the error reappears. If it does, then you'll know more of which exact steps are required to reproduce it and then I, or others might offer more assistance. And if it doesn't reappear, well, then you'll just be happy right =D. If it is "nano" that's the culprit somehow, you can try to configure git to use a different editor. In a terminal "vi/vim" (or nvim/lvim or whatever) is an option though if you're unfamiliar with it probably or emacs or gedit might be better choices on linux. git config –global core.editor “vim” for example. But if you're comfortable with nano as an editor and the problem doesn't repear, just stay with it. (I hope it works out for you!)
  4. I am lost... why would the first merge work but the seoncd one fail?

    • good question! So, the two different branches modified the same line. The first one didn't conflict with anything - it was first. The second tried to modify something already changed differently, and git detects this. and goes into resolution mode. This is good, it doesn't let a change get lost.
  5. Why does it say dislike-cilantro branch merged while we actually changed it to 2 tbs which was the like cilantro branch?

    • I was distracted there answering questions and maybe missed the statement. Can you point this out on the lesson page?
  6. How do you copy and paste in git?

    • shift + insert = paste
    • This really depends on the terminal you use - but "git bash" can be different than expected. also you can try selecting and clicking middle button or both buttons.
    • in many cases, ctrl+insert works as "copy"
  7. when using the cmd git diff <> <>, what does the following mean: @@ -1,4 +1,4 @@?

    • this particular format informs about which lines have been added and removed. it comes from the unix "diff" and "patch" commands. in the early days of Git and version control, GitHub did not exist yet and some projects were emailing commits to each other and applying changes with the "patch" command and this format then automatically worked for those commands

Exercise: resolving conflicts

:::info

How's it going?:

  1. How does git determines which line correspond to which in the two files it compares? For example, if I add a comment or an additional line of code in between two pre-existing lines, how will it determine it?

    • it does not look at line numbers only and will use various algorithms to compute the difference. in other words it can follow that a code portion has maybe only moved. it is typically rather clever in determining real changes and ignoring additional lines or unrelated comments. sometimes it gets confused if the changes are very close to each other.
    • another take away: when version-controling documents, it can be good to keep lines relatively short
    • thanks!
  2. If we deleted the like-cilantro branch after merging it into master, would git still recognize merging of dislike-cilantro as conflict? Thanks!

    • yes since it looks at the graph topology (did commits happen after each other on the same graph line or on independent lines?)
    • maybe helpful answer: git looks for the common ancestor of the two commits and from there determines if it needs to check for conflicts. if one commit is the ancestor of another, there cannot be a conflict since git assumes that "this is that the developer actively wanted" since the developer first made the one change and later the other, based on the first.
  3. If by using git merge --abort we have the same result why use it in the first place?

    • it can be useful if you want to go back pre-conflict. sometimes a conflict resolution requires more than one person to discuss which changes to keep and which to discard and then you may want to go back and abort before you get the chance to discuss with that other person.
      • did this answer the question?
        • Yup
  4. When do we finish today? I thought it was 12:30. Are we back for just 10 minutes?

    • Yes, just 10 min wrap-up
  5. When deleting a branch after rebasing, is it normal that git will warn "error: The branch 'your_branch' is not fully merged." that you can ignore the warning and force delete the branch?

    • please give more context: you did git rebase main on some branch and then want to delete that one? or did you do something else?
      • I did some commits on the new branch and switch the main and made more commits. Afterwards I switch to the new branch and did rebasing instead of merging. Then I switch back to main and try to delete the new branch.
        • if you ran git rebase master on the new branch, you modified the new branch (you moved its commits "behind" master). but the new branch is then still not merged and if you delete it, it will be harder to find the unmerged commits (if I understood the situation right)
      • Addition: You should rebase when you're on the newbranch if you want your changes from newbranch to be incorporated into master for example.
        • Isn't it what I did? "I switch to the new branch and did rebasing instead of merging".
  6. if I switch to a branch (git checkout branch-name) and then nano ingredients.txt and edit the file, it seems to change the file for all my branches?

    • if you change on that branch and commit the change, try to switch to another branch and the change should then not be there (open the file then on the other branch)
  7. How do i exit the mergetool?

    • save and quit (which tool?)
      • i did git mergetool and now i can't exit
        • Nevermind i got it :wq
  8. When I type git status, I get the following: "On branch master Your branch is ahead of 'origin/master' by 4 commits. (use "git push" to publish your local commits)"

    • We will get to this tomorrow/day 3. It's connected to GitHub/GitLab/etc and is telling you there are local commits that aren't pushed yet.
    • Ah, this happens because of the "recovery" for the exrecise, that makes it linked. It's OK, ignore it for now.
  9. When resolving a conflict manually, should I edit the file in the branch or in the master?

    • Edit right where it leaves you. It's in a middle "merging" state preparing for a commit. Don't forget to merge because otherwise weird stuff happens!
      • So after I edited, I should merge again? I am a bit lost here. I made two different branches, merged the first, then tried to merge the second, got a conflict, edited ingredients.txt right where I was (in the master). Now when I tried to merge again I get an error message "error: Merging is not possible because you have unmerged files."
        • when you see a conflict, it did not merge yet but stopped right before merging, it stages all changes that do not conflict, and leaves all conflicting changes unstaged. during conflict resolution we decide what we keep and stage the successful changes (this is the git add part). so at the end we need to git commit the merge. all of this happens on the branch where you intended to merge into. git merge always modifies the current branch, never the other branch. did this clarify a bit?
        • Yes, thank you, but it does not help because I practically do not know what command to type after I saved the corrected version of the file
          • git add [filename]
          • git commit -m "commit note about merge"
          • what do you see with git status? (I always check this one to see what is going on) "nothing to commit, working tree clean" Thanks! It worked
            • good :-)
  10. rebase : what is rebase? how do we rebase branch?

    • maybe this is helpful: https://coderefinery.github.io/git-branch-design/01-rebase/ (different lesson). both merge and rebase can incorporate changes from another branch but notice how rebase does it by moving commits on the current branch "behind" the other branch and thus creates a linear history.
      • After reading the rebase explaination page, I still don't see obvious benefit of doing rebase instead of merge.
      • I didn't expect rebase to appear now. It's not even explained how to rebase branches, but it's suggested to try. Hence, I'm confused since I don't know how.
        • good point, we should add more context for that optional exercise
  11. Once I create the branch and I make changes in ingredients, do I have to add and commit these changes?

    • Yes. Every time you do more.
  12. Can we get a copy of all these questions and answers?

    • we will publish them today (and each day) after some editing (mostly just numbering and making sure we did not forget anything) to here https://coderefinery.github.io/2023-03-21-workshop/questions/
    • example from workshop last September: https://coderefinery.github.io/2022-09-20-workshop/questions/
  13. Should I commit something after adding a new branch?

    • yes, often new work starts by first creating a branch and then creating new commits on that branch.
    • sometimes I first change the file, git add, and then before committing realize "hmm... maybe I should do that on a branch" - you can then still create the branch, switch to it and commit it on the new branch.
  14. Can non-nordic people join CodeRefinery?

    • you mean now the gitlab repository? or the chat? or our work and workshop teaching/organization?
      • the latter
        • everybody welcome. best way to join is to join https://coderefinery.zulipchat.com. our ambition is to take this beyond Nordics. the only reason for our focus on Nordics currently is that this is where our initial funding came from.
  15. can you include an update of how to resolve opendiff for Mac OS please (Xcode issues)? maybe you can share it either tonight or tomorrow if you do include it as an update

    • If this is "only" to get opendiff to work, then my advice is not to add that this time. I am worried of messing up your system with a badly-tested advice since it is not easy for me to test this. If it is about more then opendiff, can you please let us know?
  16. For those who want a certificate for ECTS credit, where do we submit logs/reflections? Is the git log -all really just a list of the commits or do we need to submit something else?

    • More information here: https://coderefinery.github.io/2023-03-21-workshop/certificates/
    • Please email to scip at aalto.fi
  17. In https://coderefinery.github.io/git-intro/branches/#merging-branches, section "If you got stuck in the above exercises or joined later": Does it make sense to clone, remote remove origin, and then checkout the branches? Should it be: first checkout branches and then remove remote origin?

    • ah! great point. it needs to be the other way around otherwise it won't work. thanks a lot for pointing it out. fixing it right away: https://github.com/coderefinery/git-intro/pull/391
  18. Do you have a workshop/tutorial for python code maintainance in order for us to practice?

    • next week we will show examples of how to do documentation, reproducibility, testing, and code organization. with Python examples (and other language examples)
  19. So where does the twitch(live stream) video go? Or did I missunderstand that the lectures are saved?

    • they are saved on Twitch for 7 days and later today we will also upload video to youtube channel. all important links on top of https://coderefinery.github.io/2023-03-21-workshop/
  20. Is there a downloadable .pdf of the instructions for the course (with the option of searching for words), to save for later use (in case the webpage is not there in 5 years)?

    • very important question. thanks! currently there is no easy way that I know of to get everything as pdf. However, the material will not disappear (but it will evolve) and we plan to also publish material on Zenodo under a citable DOI so that it becomes "impossible" to remove it
      • alright; if you ever create such a pdf or the like, be sure to send out information about it - it is always nice to have a local backup of such information. :) (but understandable with ever evolving stuff like this, that it is also less rewarding to make such a pdf).
        • most of our lesson content is built using Sphinx (more about it next week) which in principle makes it easy to generate pdf. this is something that has been requested few times but we did not find the time yet to do that.
  21. A wish for the advanced part (maybe thursday): how to split / edit hunks manually during git add -p, especially when the "can't apply patch" message appears.

    • interesting! I haven't seen that message yet. Hopefully we remember to show how to split unrelated changes into separate commits on stream.
    • can you please open a new question with few steps on how to reproduce this? then I can try it and hopefully offer a solution.

Feedback of the day

:::info Notes: Twitch will have videos immediately, I'll try to get them YouTube:ed by tonight, check installation/configuration for tomorrow, check course webpage for any other news we can think of.

Tomorrow is more git basics, trying to see more of the full power. see you then! :::

Overall, today was (choose all that apply):

How was the collaborative document (this document):

One good thing about today:

One thing to be improved for next time:

Any other comments:


Funding

CodeRefinery is a project within the Nordic e-Infrastructure Collaboration (NeIC). NeIC is an organisational unit under NordForsk.

Privacy

Privacy policy

Follow us

Contact

support@coderefinery.org

Improve this page

Source code