githubschool / corrie

Let's learn about Git and GitHub
https://githubschool.github.io/corrie/
MIT License
0 stars 0 forks source link

Parking Lot #7

Open whatupfoo opened 4 years ago

whatupfoo commented 4 years ago

Post any questions you may have here during the training.

Link to training manual

Day 1

Day 1 Meeting recording Access Password: 5N&808B+

Day 2

My apologies - I did not hit record and the mere 10mins recording that I have wasn't very helpful, if you want to practice what we have covered today, you can try and complete the breakout activity again as well as review those bullet points

Breakout Activity:

Here are some bullet points to help you review what we have covered:

Day 3

Day 3 Meeting recording Access Password: 1d?#?*@U

Day 4

[Day 4 Meeting recording]() Access Password:

Breakout rooms:

whatupfoo commented 4 years ago

Slides

Screen Shot 2020-06-02 at 12 19 24 PM

Screen Shot 2020-06-02 at 12 19 41 PM

You can read more about VCS here.

I recommend reading the Pro Git Book Chapter 1 and 2 when you have trouble falling asleep to further strengthen your understanding.

Basic Git Commands

Screen Shot 2020-05-06 at 2 17 16 PM

Steps for GitHub Flow between GitHub and Local Machine

Screen Shot 2020-01-13 at 9 24 55 AM

  1. You can choose to create the branch on GitHub, or create it locally
  2. git clone URL
  3. git checkout -b BRANCHNAME if you want to create the branch locally. If you have already created this on GitHub, then it's just git checkout BRANCHNAME
  4. git add FILENAME
  5. git commit -m "COMMIT MESSAGE"
  6. git push
  7. Create Pull Request, get approval, merge Pull Request, delete branch
  8. Back to git bash: git checkout master
  9. git pull --prune (TIP: Prune automatically with git config --global fetch.prune true) to delete remote tracking branches (i.e. branches on GitHub)
  10. git branch -d BRANCHNAME to delete local branch

Resolving Merge Conflicts:

Training Manual link

We complete the following pretty quickly in class:

  1. Head into your own conflict repo: https://github.com/githubschool/conflict-practice-USERNAME/invitations
  2. Replace with your own username and accept the invite
  3. Head to pull requests, there are 3 opened
  4. Click on the Pull Request # 3, Update README, click on Resolve conflicts
  5. Choose one sentence from the branch you want and remove the conflict markers (>>>>, ===, <<<)
  6. Click Mark as Resolved, Commit Merge, Merge Pull Request, Delete branch

Remaining tasks:

  1. Resolve conflicts in Pull Request # 2, Minor CSS Fixes
  2. Resolve conflict in Pull Request, # 1, Updates to game manual

Questions to think about:

  1. Why after click Commit Merge, we are asked to merge the pull request again? Was there 2 merges that took place? (hint: After clicking Commit Merge and Merge Pull Request, click the Insights tab at the top and click Network on the sidebar)
Click here for answer The first Commit Merge button is reverse merging from master into your branch. This makes sure that you bring in the latest update because people can be committing stuff to master while you're fixing the conflict. You also need to get an approval after your resolved your conflict. The second Merge Pull Request button then merges your updates into master.
  1. What do you think happened in the conflict in Pull Request # 2, Minor CSS Fixes? The conflict markers are unlike we've seen in the first pull request. Why is that?
Click here for answer If you click on Files Changed, you can see what was the latest code that was committed. You can see that someone actually committed conflict markers into code. So the odd markers are actually conflict markers _on top_ of conflict markers. Takeaway: Be sure to clean up your code. If you're using the web UI to resolve your conflicts, GitHub will make sure you clean everything up before you're able to resolve it. Many IDE tools also makes sure you clean this up too. The danger is when you're using command line. Git doesn't give a star if you don't clean it up.

Resolving Pull Request # 1

  1. In this Pull Request, it says that this conflict is too complex so we'll have to take this down to our local machine to fix this
  2. git clone repo to your local machine
  3. git checkout <branch name> to the branch that is causing the conflict, in this case, it's the manual branch.
  4. git merge master this command means you're pulling changes from master into the branch you're checked out to. This is what we call a reverse merge.
  5. Conflict messages will appear to show you which files are causing the conflict
  6. Open those files and solve conflict
    • the first file is called play/mini/mini_bored.html. So use your editor to open that up and fix the conflict
    • the second file is called play/manual/manual.html, open this up in your editor again.
    • ❓ It appears that play/manual/manual.html does not have any conflict markers, what do you think happen here?
    • HINT: Run git status to find out
      Click here for the answer

git status tells us that this file has been "deleted by us", "us" in this case is manual branch. This file was deleted in our branch, yet it was modified in master. So the very existence of the file is the conflict.

git status also tells you what to do. Either git add FILENAME to add it back or git rm FILENAME to remove it

  1. git add <file name> or git add . to move multiple files to staging area
  2. git commit ➡️ your editor will pop up to ask if you want to change the default commit message, if you close it out, then it will go with the default message. Note: When you're solving a merge conflict, you don't have to type git commit -m to input the message
  3. TIP: If you don't want your editor to pop up, and want to go with the default message, you can use git commit --no-edit
  4. git push
  5. Merge the pull request once you get it approved by a reviewer.
whatupfoo commented 4 years ago

Special Files in a Repository:

Additional settings:

Extension tools for LabView:

To answer your question, @jhill0914: Git LFS is on-prem.

When Git LFS is enabled on the GitHub Enterprise Server appliance, large assets are stored on the data partition in /data/user/storage

whatupfoo commented 4 years ago

Git LFS

  1. Install git LFS
For a fresh repository, where no files have been added or there's only the initial commit / no versioning on any large files yet, click here - In the repository, run `git lfs track ".vi"` - This command adds a `.gitattributes` file to your repo. - Keep adding files to track, such as `.ctl`, `lvproj` etc. (Any binary or large files) - You can save this `.gitattributes` file and add this to another repository - **TIP:** [Create a template repository](https://help.github.com/en/enterprise/2.20/user/github/creating-cloning-and-archiving-repositories/creating-a-template-repository) with the same `.gitattributes` and `.gitignore` files to help other teams get started with their repo
For an existing repository with version history, click here - `git lfs migrate info --everything` to find files that needs to be tracked with Git LFS - Run ` git lfs migrate import --everything --include="*.ctl"` - `git push --force` **NOTE:** this will overwrite history, so make sure everyone's work has been pushed to github before history is overwritten. Everyone will have to re-clone the repo.
  1. Individual contributors can install git LFS, and do their work normally
  2. Any IDE tools like GitHub Desktop, GitKraken or VSCode would know how to handle git LFS, you would just work seamlessly.
  3. git lfs ls-file to see all the files in LFS
  4. Find more documentation on LFS commands here
whatupfoo commented 4 years ago

Hey @RhidiumRh - not sure who else needs to be tagged here, but here are the files related to the git extension for LabVIEW Jared was talking about.

You can clone this down and copy the folder, push it up to github.korry.com for others to look at too.

RhidiumRh commented 4 years ago

@rwnfoo If I install the "labview-git", do I need to install LVCompare.exe and LVMerge.exe or does the installation script install them?

whatupfoo commented 4 years ago

Hi @RhidiumRh 👋
The installation script should install them. Also, thanks for calling this out because I notice the paths were not updated, so I went ahead and corrected it.