scriptya
2 posts
by Nick Full Stack Software Developer
Don't wanna be here? Send us removal request.
Photo
A simple photography single Responsive Portfolio
project link: https://mrnicklaus.github.io/Responsive-Portfolio-Site/
0 notes
Text
Git and GitHub Commands

Git and GitHub Summary Notes
1. Create a Folder with Files
2. Install Git `git init`
3. To have a look at the stage area `git status`
4. To add the file to the stage area `git add + filename`
5. To commit the file under version control we use `git commit -m "message of the file"`
6. Actual Procedure when a password is required ``` git init git config user.name "someone" git config user.email "[email protected]" git add + filename git commit -m "msg in present tense" ```
Reference https://tecadmin.net/tutorial/git-tutorial/git-create-repository/
7. To see the changes made after making some additions or deletions we use `git diff`
8. To return the changed file to the previous version we use `git checkout + filename`
Staging Area
Removing documents in the staging area - `git checkout + filename` after the `git add .` command
Un-Staging files `git rest HEAD + filename`
Deleting Files
`git restore <file>..."` to discard changes in working directory `git checkout` to restore a deleted file from the folder To restore a deleted file with `git rm` we use 1. `git reset HEAD + filename`
2. `git checkout + filename` To move everything to the staging area (changes and deletions) `git add --all`
Managing your log
We use `git checkout + branch name` to change branches
To create a new branch we use `g`it branch + new branch name
To check out list of branches we use `git branch`
To merge branches we use `git merge + branch to be merged`
To rename a branch we use `git branch -m (org branch name) (new branch name)`
To delete a branch we use `git branch -D +branchname`
To switch to a hidden branch in github we use `git checkout -b (name of branch in git) (name of remote/name of branch in git)` ##### Grabbing all the github files
To create a mirror of all the branches from github we use `git clone --mirror (clone url) .git`
To get all the files to appear on the folder `git config --bool core.bare false`
To refresh the folder to get all the files `git reset --hard`
Using GitHub as a template
Issue a remove command to remove all git log files to make the project a brand new project under your folder `rm -dfr .git` (be careful when using this command, its very dangerous!! lol)
To create a template we clear out any scripts or java-script files that we might not use
Then we issue a `git init` to officially make it your project
This will be followed by `git add .` then we commit the template `git commit -m "new project"` to add the template to the log file
GitHub
1. Create a new remote repository on GitHub with the local filename
2. Transfer command `git remote add origin (name of the remote) https://github.com/mrNicklaus/Poem.git (name of the branch)`
3. Push command `git push -u origin master`
Local Branching
1. To initialize branch `git branch + branch name`
2. To change branches `git checkout + branch name`
3. To merge we return to the master branch to initialize the branch `git merge + branch name to be merged`
4. Remember to commit your changes before `git merge`
5. After merge we push our changes to our local rep we use the command `git push -u rhyme(remote ) master (branch)`
Remote Branching
https://github.com/mrNicklaus/Marvela/network
1. Create a new rep with a read me file
2. Create a new file.txt
3. Commit file after adding a description of the file.txt that you have just created 4. Create a branch from the master
5. Inside the new branch edit changes in the file.txt
6. Commit the changes to the new branch
7. Create another file in the master branch and commit the changes
8. We use the term pull to merge two branches together, so we click on `New Pull request`
9. Choose the base as the master and the compare as the new branch that was created
10. Create Pull Request
11. Merge Pull Request
12. Add a message about the merge
13. Confirm
14. The merge has been performed successfully on GitHub /Remotely
1 note
·
View note