Understanding moving files/Git Status

Learning Challenge

Git Assessment

Question

I am wondering if I’m doing this right. On the git assessment, you are instructed to move 3 jpgs from the images directory to a newly-created drawings directory. This is on the drawings branch. I think I’ve done the correct thing but when I first progressed through this assessment I worried that I was not properly doing things and just moving files around in my terminal without properly staging and committing them in git. Obviously, this would not be the point of the exercise! This is the point of the exercise where things begin to get tricky and less intuitive for me but I think if I understand, I’ll be in a good place.

Basically, as I show below, I’m moving from the git-repo-management directory to images directory so I can create the new drawings subdirectory there. Then I move the three jpgs from the images dir to drawings dir.

After I do this, I check git status to see what’s going on and it says “deleted: , in red, 3x”. The whole purpose of this is to get Git to properly track things. Shouldn’t it be logging that I’m moving the files, not deleting them? Or is deleting them what’s happening in Git’s “mind”? Generally, I’m just worried that I’m not correctly performing the Git process, especially in terms of making changes, staging them and committing them, in both master and our new drawings branch, Thanks in advance for your help , screen shots below.

Screenshots

Screen Shot 2020-12-09 at 10.10.59 AM|675x500

I should also add: I’m confused about one issue with git. If I don’t see git-repo-management as the directory I’m working in, are the changes being logged to git? How would access an images folder while staying in the git directory? I feel like I’m jumping all over the place and have no idea where I am :slight_smile:
Thank you!

Hi, and welcome to the community!

From what I see, I think you’re on the right track so far. It definitely takes some practice getting used to moving files and moving between directories using the command line. I would recommend looking at your directory/file tree (under Explorer in VS code) to visually confirm that the files are in fact moving where you intended them to go. You should be able to see the changes in the tree in VS code immediately after you use the commands in the terminal.

I don’t think it’s a red flag that you see deleted files under git status, because you have essentially removed the images from one directory in order to add them to another.

Finally, from the screenshot, I don’t see that you have used the commands for staging and committing any of those changes yet. So, make sure that you are in the root directory git-repo-management, and you can use the add and commit commands. You will need to make sure that you are staging and committing the appropriate changes for each branch.

Let me know if this helps, but again, it looks like you are moving in the right direction so far.
Jesse

It does help, thanks you! I do see the changes and I hadn’t staged and committed by that point.

I’m moving along now and am merging the branches to the together branch. A couple of questions:

  1. My File Tree for this branch has the file .gitignore. That’s NOT in the screen shot - is that indicative of a mistake?
  2. My images were in the wrong order because I had forgotten to close an img element. I fixed this in the together branch but do I need to back and fix this in the other branch were the error was? Will that throw things off when getting graded?

Thanks, Jesse!

I should also add – I completed the exercise though have yet to submit. I don’t want to waste any failures! My HTML, when I access the VSC file through <code .> when on the master branch is identical to the assessment page and my file tree is the same (except for that .gitignore which maybe I should be ignoring given the title!). Should this be enough to submit? Is there something else which might be off? When I made the changes to the master-together merge I had to go in and manually do it (VSC didn’t suggest any edits). I figure this is OK but definitely wanted to check on that as well. Jesse, thank you for your help!

Don’t worry about the .gitignore file - you should still have that in your tree.

If you found a typo, you will definitely want to correct it and recommit in each branch where you had to make the correction.

I can’t actually check your work, since it is an assessment :cry:…but it does look like you’re focusing on all the right details and asking yourself the right questions! Keep it up!
Jesse

Thanks Jesse. I submitted and foolishly MISSED a typo when correcting another typo. Very frustrating! I guess that is an area of weakness for me – attention to detail. This is the message I got back. I’m trying to figure out what the —a/site.html +++b/site.html means? And the @@-11.6 ++ 11.6@@? Any guidance on that?

These diffs can be challenging to interpret for sure.

First, check out the reply I wrote to another student this morning, with the same question, about how to interpret the diff.

In this case, the + lines show the code that is in your file. It looks like that typo was committed into multiple branches.

You can open each branch one at a time, fix the typo, save, add, and commit.
I would double check each branch after you’re done, before you re-submit.

Jesse

1 Like

Thanks Jesse! Just finished it, submitted and passed. You’ve been very helpful! I’ve definitely got a familiarity with Git now!

1 Like

hey i just have a quick question about this topic. i failed my assessment and Im not sure if it’s because i moved the images from vs code into the new folders. does it make a difference whether you move them using the command line or straight from vs code?

Hi cris, welcome to the community!

Great question - it is certainly possible to do a step like this directly from the VS Code user interface rather than through the command line. As long as the images end up where they are supposed to be for each branch, that shouldn’t be a problem.

However, if you took this approach, it may have led to mistakes in other areas. For example, if you moved the images without using the command line, you could have missed some key details such as changing the directory before committing, which could affect your final product.

Jesse

1 Like