How many participants can this document support? (+1)
How many people help answer questions in the document?
Any tips on making code commenting more of a consistent habit? (+3)
do I need to login somehow?
How should one report issue in private to instructors/manager? email to support@coderefinery.org or radovan.bast@uit.no or direct message on https://coderefinery.zulipchat.com/
Will you provide a certificate once completed the course?
How can an individual find others to collaborate with?
can we share images of the presenters on social media? eg picture of monitor?
I can't find a link to the document you shared in the screen while presenting, where is it?
How do I register to receive the emails directly? Link?
May I indicate I attended the workshop in my CV? Is it actually recognized?
Course organiser: what microphone are you using?
How do i know if im in a team?
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/?
Is there a reason to choose for instance gitlab instead of github or bitbucket? Any nice comparison on the git repositories?
Can we do this "blame" (better name: "annotate") also on the command line?
https://coderefinery.github.io/git-intro/basics/
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.
What is a fork?
Working on different ''github''-ed projects simultaneously, do I store locally all of them, hence using my own local memory?
Can you zoom in?
Are you using command prompt or Git Bash?
I made a mistake and i have created a .git file in workshop. How do I remove it?
How do you see hints in git bash?
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...
I am unable to access the live stream .
Why two steps of "stage" and "commit"? What is the main purpose and perhaps the reason behind this setting?
Shouldn't the commit header always be in imperative?
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?)
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.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
git config --global core.autocrlf false
can we go a bit slower
Is the commit message the same thing shown in the "Blame" menu?
How is the speed so far for all (add an "o")?
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?
What is the purpose of -m?
Can we edit the commit message after commit. May be for better documentation?
git commit --amend
, note that this modifies the history)how do you get the terminal input commands as is shown on screen (lowest pannel)?
Is there a git GUI?
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
vi
, nano
, emacs
, ...Is there some kind of cheat sheet with all git commands?
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
git add .
(please notice the dot, which means all content of this directory)Can one create nested git repos?
I tried to do the git commit
but I get the following message ->
*** Please tell me who you are.
Run
I don't have the instructions.txt etc. The instructor told it was not necessary to type along.
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?
git init
in there.What is the meaning of stage in git
git
that they should be included in the next commit.Im in vim entering instructions how do I exit and save?
https://coderefinery.github.io/git-intro/basics/#exercise-record-changes
:::info
Questions about exercises continue here:
When I write git add instructions.txt, results "fatal: pathspec "instructions.txt" did not match any file
Can I git add two files at the same time?
Getting this error while using git diff <hash> -- -bash: syntax error near unexpected token `newline'
git diff <hash>
<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
How do I leave the git commit window when I added my comments?
Can you share the zoom link for this course?
what does "(HEAD -> master)" mean? this is next to my most recent commit when looking at git log
I got stuck after git diff
command, I have a list of differences and (END) at the end. How do I get back?
q
or control-c
help?
I used vi editor, I modified the files, I typed git diffESC
:q!
several times to get out?when I type git commit -m
it returns nothing to commit, working tree clean. so when I try the git -diff nothing has returned
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.What does this line mean, for example "@@ -3,3 +3,4 @@" when git diff
? (+1)
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".
Does anyone experience very slow git command execution?
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?
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.
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?
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?
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?
$ git difftool --tool=meld 101bd58 instructions.txt
woks nicelyI went further down to optional exercises. git difftool --tool=meld <hash>
doesn't work me. I have meld installed.
git status
or git diff
?
<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?Still trying to create the txt files through git bash?
nano filename.txt
will start editor and make a file with that nameControl-x
then y
will save and exitwhy does $git diff show nothing if I am using Notepad++ as my editor but works with nano?
what does diffrenet colors in git diff mean. what is the meaning of red and green lines?
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?
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...
Can I use git to track xlsx, xls and csv files?
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
git add
on a file which has no modification will not do anythinghttps://coderefinery.github.io/git-intro/basics/#git-history-and-log
The top two screens are cut off (+1)
What is the advantage of using difftool instead of just git diff?
My branch is named "main" instead of "master". Should I worry about it?
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?
Is is possible to reduce the low end of the male instructor's sound? It's quite booming.
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)
git diff
, so without using opendiff
.Is only the long-version hash unqiue not the short version?
<hash>
, it is just the output that is shortened for better visibility.I tried to install Xcode in my mac but got message "No Operating Systems available for download"
xcode-select --install
?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.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)Is there a way to easiy copy/paste hashes in the command line? Manually retyping doesn't seem convenient
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?
How do I create a .gitignore file?
nano
or the other editors you have used works.Do you usually version control the .gitignore and .gitconfig files?
btw. Any one struggling with diff tools who is familiar with vim may use git difftool --tool=vimdiff
. You can also use vscode.
Is it possible to install FileMerge (opendiff) on mac without instsalling the full XCode? It takes too much space.
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?
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
Your shared windows doesn't fit the stream resolution size.
m1 m2 stands for master 1 etc.. or for merged 1?
Which changes are commited straight in the master branch?
So. a branch is a copy of a commit by another person?
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?
No need to type this command for git config
. They can be copied from the website. +1
i cannot type anymore in gitbash: says (END) after doing git log --stat. How do i continue?
q
work to exit?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).I really like the command history in the separate terminal window. That's very helpful. How do you do that?
history
file? smth like watch -d -n 3 'cat <history file | tail -n 10'
?
Would git warn if you use some of the "control" terms (e.g. push) for giving alias names?
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?
git graph does not work for me. it tells me: git: 'graph' is not a git command. See 'git --help'. (+1)
git config --global alias.graph "log --all --graph --decorate --oneline"
git config --global alias.graph "log --all --graph --decorate --oneline"
ok now it works. thank youWhat 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?
git switch -c branch_name
('-c' for "create")... Focus on getting proficient with one option.How to remove commit? Basically, how to roll back? (+1)
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 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
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"?
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?
I accidently created the less-salt branch while in the experiment branch. How do i remove this branch?
git branch --delete less-salt
You can have branches locally even if you have a linear history on the remote repo, so branches are still useful (right?)
How do you remove git aliases?
git config --global --edit
and remove them from the file..gitconfig
in your home folder and you can also edit them directly there (but the above advice is nicer)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.
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.
how do i create README.md file?
nano README.md
How to delete an added (not commited) file?
git status
and it will also give you hints on how you can unstage the file.
(use "git restore --staged <file>..." to unstage)
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).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
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.
what time is exercise until?
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.I added and commited a file to master branch. Is there a way of going back one commit?
hash1
, you can do (be careful with this command!): git reset --hard hash1
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
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
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!!
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?
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.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.
git status
.https://coderefinery.github.io/git-intro/branches/#exercise-create-and-commit-to-branches
:::info
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.
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
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).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?
What senarios should we consider rebasing instead of merging?
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.
I have got "Merge made by the 'ort' strategy" instead of recursive. What is the difference?
What is the meaning of the line colours after mering the branches? (the green and red lines)
But isn't this already part of the exercises we were supposed to do before hh:20?
Can we merge two branches other than master? e.g. experiment with less-salt?
git merge somebranch
merges "somebranch" into my current branch, whatever my current branch is.
Can I do without "checkout", since we have "switch"?
Generally speaking which changes should stay on master branch?
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?
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.What if you want to revert to a version of the file that was in a deleted branch?
git graph
can help you find the commit and then checkout
from it (the whole version, or just that file. More on this later).Why different colors in git graph after merging experiment with master?
The command "Git graph" gives me: git: 'graph' is not a git command. See 'git --help'.
git config --global alias.graph "log --all --graph --decorate --oneline"
first to define the commandHow 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?
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?
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?
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?
git init --bare test_repo.git
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?
A tag then refers to the whole repository, not a particular file?
The issue with the tag is the name of the tag (it was called noble-2021 and not nobel-2021)
Is there a benefit to using Git from Terminal/command line compared to GitHub Desktop or other GUI alternatives?
typo!!!
What was the purpose of -a when creating the tag?
-a
is for annotate
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)grep mytag* | git show
and it somehow worked! Although it still throw error zsh: no matches found: mytag*
.git tag -l "v1*"
for example to search for all tags that match the v1* pattern.Is it possible to change the annotation of an existing tag?
https://coderefinery.github.io/git-intro/conflicts/
What if you need to resolve a conflict and git asks you to do that in vi???
git config --global core.editor "code --wait"
to set up VSCode as the default editor)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.
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?
git config --global core.editor
jobs
do you get any result? (Just to check that nano isn't running in tha background.)
-nope, nothingnano --version
.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.
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.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!)I am lost... why would the first merge work but the seoncd one fail?
Why does it say dislike-cilantro branch merged while we actually changed it to 2 tbs which was the like cilantro branch?
How do you copy and paste in git?
when using the cmd git diff <> <>, what does the following mean: @@ -1,4 +1,4 @@?
:::info
How's it going?:
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?
If we deleted the like-cilantro branch after merging it into master, would git still recognize merging of dislike-cilantro as conflict? Thanks!
If by using git merge --abort we have the same result why use it in the first place?
When do we finish today? I thought it was 12:30. Are we back for just 10 minutes?
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?
git rebase main
on some branch and then want to delete that one? or did you do something else?
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)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?
How do i exit the mergetool?
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)"
When resolving a conflict manually, should I edit the file in the branch or in the master?
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?git status
? (I always check this one to see what is going on)
"nothing to commit, working tree clean"
Thanks! It worked
rebase : what is rebase? how do we rebase branch?
Once I create the branch and I make changes in ingredients, do I have to add and commit these changes?
Can we get a copy of all these questions and answers?
Should I commit something after adding a new branch?
Can non-nordic people join CodeRefinery?
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
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?
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?
Do you have a workshop/tutorial for python code maintainance in order for us to practice?
So where does the twitch(live stream) video go? Or did I missunderstand that the lectures are saved?
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)?
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.
:::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:
git config
, please