Lessons in Linux

no changes added to commit (use “git add” and/or “git commit -a”) [root@csc-studev01 myscripts]# git add * [root@csc-studev01 myscripts]# git commit -m “Added SIEM to seccheck.sh” [AddSIEM e94d34e] Added SIEM to seccheck.sh 1 file changed, 1 insertion(+), 1 deletion(-) [root@csc-studev01 myscripts]# _

At this point, you’ve modified the seccheck.sh script in the AddSIEM branch only. If you switched back to the master branch in your cloned repo using the git checkout master command and viewed the seccheck.sh file, you’d see that your changes are not there! That’s because they are only shown in the AddSIEM branch. Now, let’s push our branch to the original repo. Luckily, you don’t have to remember the location of the original repo, because after you clone a repo, Git remembers the original location and allows you to use the word “origin” to refer to it:

[root@csc-studev01 myscripts]# git push origin AddSIEM Counting objects: 3, done. Delta compression using up to 4 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (3/3), 293 bytes | 0 bytes/s, done.

Total 3 (delta 2), reused 0 (delta 0) To /home/jason.eckert/myscripts/ * [new branch] AddSIEM -> AddSIEM [root@csc-studev01 myscripts]# _

This uploaded the AddSIEM branch from the cloned repo (in /root/myscripts) to the original repo (in / home/jason.eckert/myscripts). Let’s switch back to the jason.eckert user and see if the branch was successfully uploaded to the original repo with the git branch command, and then merge the changes in the AddSIEM branch with our current branch (master) using the git merge command:

[jason.eckert@csc-studev01 myscripts]$ git branch AddSIEM * master [jason.eckert@csc-studev01 myscripts]$ git merge AddSIEM Updating 53f9566..e94d34e Fast-forward seccheck.sh | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-) [jason.eckert@csc-studev01 myscripts]$ _

That’s it! Now, other users who have a cloned copy of the original repo can run git pull origin master to download an updated (merged) copy of the master branch from the original location that has the new SIEM feature.

Let’s switch back to the cloned repo in the root user’s home directory and do this: [root@csc-studev01 myscripts]# git pull origin master

From /home/jason.eckert/myscripts * branch master -> FETCH_HEAD 53f9566..e94d34e master -> origin/master

Made with FlippingBook Online document