Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
3 views

Modules 3 Software and 4 git

CSCE software and git

Uploaded by

sbri0489
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Modules 3 Software and 4 git

CSCE software and git

Uploaded by

sbri0489
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 21

CSCE 1015

z
Version Control
& Software
z
Version Control

 Do no harm!
 How can many programmers work on the same team without
killing each others code and killing each other?
 You need rules and a traffic cop
 Enter git
z
git

 Simple set of commands to let programmers work on code


locally and then push changes to a main body of code
 If there are conflicts with multiple contributors, then the two code
streams can be merged with the help of a human.
z
Create from a command line

 Create a READMEmd file to document your repo


 Git init initialize your repo (look for hidden file)
 Git add add file to repo (use ‘.’ to add all)
 Git commit… I like what I have created and want to save it
 Git branch … make sure I am on the main branch
 Git remote do once to associate your local repo with github
 Git push I are REALLY happy with code push a committed files to git
z
Modify or Add New Files

 Date > currentDate.txt


 Echo Additional info about the repo >> README.md
 git add README.md
 Git status
 Git add .
 Git status
 git commit -m ”new files and changed files"
 Git status
 git branch -M main
 git push -u origin main
z
Updated Repo
z
Let’s Try doing this with VS Code

 Create a folder
 Add some files to the folder
 Anything in the files will be fine for
now
z
Create the Repo

 Push the Blue Button


 Create the repo – enter a name
z
Add changes to Repo
Add message and Commit & Push
z
Add a Message
Publish Branch
z
Add local repo to GitHub
Public v. Private
z
And your are done!
Now you can see the repo in GitHub
z
Make a change to the file

 Stage the changes by clicking on the plus sign by


Changes
 Add a comment
 Commit & Push
z
Clone a repo

 gh repo clone gtjames/dandy


 Cd to the folder and see the
files
z
Go to folder either on the command line
or VS Code
z
VS Code (a.k.a. Code)

 IDE – Interactive Development Environment


 HTML
 C, Java, JavaScript
 Bash
 anything text
z
Run Code

 Create these files in VS Code and test to see that they run
 Hello.c // C code
 Hello.js // JavaScript
 Hello.sh # Bash shell script
 Hello.py # Python
z
hello.c

#include <stdio.h>

int main (int argc, char *argv[]) {


if (argc > 1)
printf("Hello UNT!");
else
printf("Hello %s!", argv[1]);
}
z
hello.js

// Run frpm the command line


// node hello.js
// Get the name from the command line arguments
const name = process.argv[2] || 'World';

// Print the greeting


console.log(`Hello, ${name}!`);
z
Hello.sh

#!/bin/bash

# Check if a name was provided as a command-line argument


if [ -z "$1" ]; then
name="World"
else
name="$1"
fi

# Print the greeting


echo "Hello, $name!"
z
hello.py

import sys

# Check if a name was provided as a command-line


argument
if len(sys.argv) > 1:
name = sys.argv[1]
print(f"Hello, {name}!")
else:
print("Hello, World!")

You might also like