git

/* no more masters ...huh */
git config --global init.defaultBranch main

Setup Github & local machine git
/* create project dir */
mkdir <newAmbitiousProject>
cd <newAmbitiousProject>

/* initialise */
git init
touch <aFile>

/* check what files are changed */
git status

/* add file/dir to be tracked by git */
git add <file/DirName>

/* commit changes w/ comments */
git commit -m 'some useful log'

/********** GITHUB stuff ****************/
Log into github. Create a public repo like icmp15/<thisWillRotRepo>

/****DO NOT add README, license etc... as it creates file in remote and has issues w/ local **/

/* on local machine - all Github access is set */
add 
brew tap microsoft/git 
brew install cask git-ceredential-manager-core
/* this allows us to use MFA etc for accessing github w/ ICMP account. */

/* check name of remote repo */
git remote -v

/* push local changes to remote */
git push origin maingit 


using git Commands:

/*add file to be tracked*/
git add <filename> 

/* untrack and remove a file*/
git rm <fillename>
/*remove from git repo and not filesystem*/
git rm --cached <filename>

/* change file name*/
git mv <origName> <newName>

/* commit the changes locally..e.g removed filename or added new file comments*/
git commit -a -m 'comment''

/* update remote dir ... git push origin branch_name*/
git push origin master 
/* depending on the <cur dir>/.git/config settings sends updates to github*/

-----------------------------
issue w/ git syncing. the key was not known to the ssh-agent.

ssh-add <~/path/to/key_file>
<enter the passphrase>
-----------------------------
/* discard changes made in a file*/
git checkout -- <filename>
/*though discussions suggests to use*/
git stash save --keep-index --include-untracked
/*the stash can then be dropped*/
git stash drop

Comments