![]() If a repository (often called repo) is available to the public, you can start using it. The purpose of this blog is to get you familiar with using GitHub, and then by the time you're creating scripts and code to automate your DDI environment, you'll know exactly what to do. I personally got started several years ago learning helping out with Cisco DevNet instructions on GitHub. I use the word code very loosely here, because you can also do things like write and track documentation, course instructions, or even books in GitHub. The term "git" describes a distributed version control system designed by Linus Torvalds (creator of Linux) which allows users to easily find code, keep track of versioning, and modify code as needed. GitHub is a very popular service which allows people to store their code in containers called repositories. But there's a ton of Git and GitHub information out there to help you with these concepts and, of course, we're here to help if you have questions, as well! What is GitHub? This blog is meant more to familiarize you with concepts using the Micetro documentation as an agent to help you learn. Luckily Men&Mice provides our documentation repo publicly on GitHub for you to see and play around with.ĭocumentation is a really safe place to get started and don't worry, we won't let you publish anything inaccurate. Im mentioned that a message can be associated with every commit, which we entered by using -m.Getting started with automating your network management? Understanding how to use Git tools like GitHub is a great place to start. Once you have staged your files, you can proceed to a commit. But if you add -a to your commit, all files would be committed and you would fail to notice possible errors. If you selectively stage them, you would notice changes in each file. For instance, let’s say you opened a file and changed it by mistake. This process, however, is very dangerous as it can be damaging. You could avoid this command by prefixing -a to git commit, which adds all changes to tracked files for a commit. You can add all the tracked files by running: git add -u You need to add these files again to stage the changes in tracked files for the next commit. If you want to have a look at the changes to a particular file, you can run git diff. ![]() You can check the changes to the tracked files from the last commit by running git diff. After changing them, we notice through git status that Git notices the change in the files that it is tracking. Let’s now change a few files after our first commit. Yet, running a simple git rm will not only remove it from Git, but will also remove it from your local file system as well! To tell Git to stop tracking a file, but still keep it on your local system, run the following command: git rm -cached In such a situation, you tell Git to stop tracking them. Let’s say you have added files to Git that you do not want it to track. If you use add recursively, it would add all such files, if they are present in your repository. There are certain files (like compiled files) that are usually kept out of the Git repository. You could use git add recursively, but be careful with that command. To add multiple files, we use the following (note that we have added another file for demonstration purposes.) git add myfile2 myfile3 git add my_fileĬhecking the status of the repository again shows us that one file has been added. ![]() We need to add files specifically to Git order to tell Git to track them. git statusĪt this point, we do not have any files for Git to track. To check the current status of your repository, we use the git status command. Now that we have some files in our repository, let us see how Git treats them. Note that if you are going to add Git to an already existing directory, you do not need to perform this step. The next step is to create some files in the directory. The reason we prefix -global to the command is to avoid typing these config commands the next time we start a Git project on our system. In our case, the username ‘donny’ and email would be the default values.Īlso, we set the UI color to auto so that the output of Git commands in the terminal are color coded. It is important to note that if you do not set your name and email, certain default values will be used. You can do it as follows, replacing the values with your own name and email. Next, we need to configure our name and email. git directory that contains all the Git-related information for your project. This is done using the command init, which creates a. The first step is to initialize Git in a directory. Alternately, you could use Git to manage one of your existing projects, in which case you would not create the demo directory as below. Let’s create a directory inside which we will be working.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |