Lessons in Linux

new file: chownscript.sh new file: filemaintain.sh new file: newuserscript.sh

new file: seccheck.sh new file: sysusage.sh

[jason.eckert@csc-studev01 myscripts]$ git commit -m “My first commit” [master (root-commit) 53f9566] My first commit 5 files changed, 60 insertions(+)

create mode 100755 chownscript.sh create mode 100644 filemaintain.sh create mode 100755 newuserscript.sh create mode 100644 seccheck.sh create mode 100644 sysusage.sh [jason.eckert@csc-studev01 myscripts]$ _

Next, let’s modify the filemaintain.sh shell script using the vi editor, see that Git detected the modification, stage the files in our repo again and create a new commit using an appropriate description of the changes that we made (in this example, I added XFS checking to the script): [jason.eckert@csc-studev01 myscripts]$ vi filemaintain.sh [jason.eckert@csc-studev01 myscripts]$ git status

On branch master

Changes not staged for commit: (use “git add ...” to update what will be committed) (use “git checkout -- ...” to discard changes in working directory)

modified: filemaintain.sh

no changes added to commit (use “git add” and/or “git commit -a”) [jason.eckert@csc-studev01 myscripts]$ git add * [jason.eckert@csc-studev01 myscripts]$ git commit -m “Added XFS checking to filemaintain.sh” [master 08e7f90] Added XFS checking to filemaintain.sh 1 file changed, 1 insertion(+) [jason.eckert@csc-studev01 myscripts]$ _ git log To see a list of all commits (and who made them), you can use the git log command, and to rollback to a previous version of the file, you can use the git reset --hard command. Say, for example, that I didn’t like the XFS checking additions I made to filemaintain.sh and wanted to roll it back to the previous version. To see all the changes I made to the files in my repo and rollback the change to “My first commit”, I could use the following commands. (HEAD is simply a reference to the most recent commit):

[jason.eckert@csc-studev01 myscripts]$ git log commit 08e7f90fd4c1820eab77968ee98c8a7682c43aa8 Author: Jason Eckert Date: Mon Aug 13 14:54:20 2018 -0400

Added XFS checking to filemaintain.sh

Made with FlippingBook Online document