Some Git basics Happy Git and GitHub for the useR

Let’s checkout the second Commit named “div added” with git checkout yourcommitsID (just copy and paste the Commit’s ID to the “yourcommitsID” part). A Repository is the location where your code is stored, so a folder on your machine containing your project code. After turning this folder into a Git Repository (we’ll learn how this works soon), Git manages the project code version history. These terms can be confusing, especially for beginners.

git fundamentals

It’s also useful when working independently. You will be relying more and more on your own commit history in the future when revisiting old code. Finally, let’s upload your work to the GitHub repository you created at the start of this tutorial. Take one last look at your commit history by typing git log. Add README.md to the staging area with git add README.md.

Five tips for CI-friendly Git repos

You can configure settings for this later, but don’t worry about it too much for now. And git commit -m “div added” we can add this new code as a second Commit to our Branch. Note that git pull always merges into the current branch, regardless of what else is given on the command line. This creates a new directory “myrepo” containing a clone of Alice’s repository. The clone is on an equal footing with the original project, possessing its own copy of the original project’s history. At this point, I’m going to add, commit, and push.

Your home folder is represented by ~. Navigating Files and Directories covered variations of home folders – sometimes ~ stands for /Users/your_username and sometimes it stands for /home/your_username. If you’re not sure if you’re in your home folder, just type cd ~. Once it’s made, move into it with the cd command. Git checkout -b creates a new Branch based on the latest Commit of the Branch you’re currently working in.

Show Notes

Finally we will build on that that to derive an understanding of how some common git command-line tool works. Creating .gitignore files to exclude files from being tracked by Git. git fundamentals While working on Linux, Torvalds needed a version control system to manage the Linux codebase. Blob stands for Binary Large Object. Each version of a file is represented by blob.

git fundamentals

Any important git and GitHub terms are in bold with links to the official git reference materials. Type git log and look at the output. You should see an entry for your “Add hello_world.txt” commit. You will also see details on the author who made the commit and the date and time of when the commit was made. If your terminal is stuck in a screen with at the bottom, just press “q” to escape.

Lessons In This Course

It’s possible to set these policies on your repo, and most real-world projects have such policies. A branch represents an independent line of development.

  • These may be node_modules in a node project, or bin, obj folders in a .NET project.
  • At this point, I’m going to add, commit, and push.
  • To integrate the commits into your master branch, you use git merge.
  • Using a VCS also means that if you screw things up or lose files, you can generally recover easily.
  • When we finish all the work in a release branch, we must merge the branch in the development and main branches.

Chia sẻ bài viết

Bình luận (0)

Để lại bình luận