-->

Tuesday, May 28, 2019

Git Tips

Git can be confusing. You try cloning someone else's repo and it doesn't work. Or you = try to move branches…its all kinda counter intuitive. Unless I write down some important lessons learned right here.


Add Collaborators

  • The master of the repository has to add users to allow them to interact with stuff. I'm yet to master the security features, as I accidentally overrode the master branch today (DAMMIT)
  • Here is the link to the guide used.


Who are you?

To collaborate you must set your glob= al user variables under config.
  • git config --global user.= name
  • git config --global user.email
  1. git con= fig --global core.editor [vi | cat | w]
    Change = the main editor to vi or cat, etc

Git Branch =Making New Backup Folders

I like to think of branches as different backup folders. As one familiar with most DOS commands, what is the equivalent of making a new folder (mkdir) and cding into it? Let along listing (ls) them?

mkdir
git branch [branchName]
ls
git branch -= a
cd
git checkout [branchName]

  1. git branch -a =3D=3D ls [= your branches] 
  2. git branch [branchName]= =3D=3D create a new branch
  3. git checkout [branchNam= e] =3D=3D cd to your brannch


Git Add = Prepare to Save.

    1.  You need to use -a or . from within t= he same folder as the .gitignore command for this to work.

Git Commit = Save Local Copy, but you need to have a message (apparently)


  • Commit doesn't like you unless you add in -m after calling the command. So you must either vi or cat or something else. As long as there is a message.

After Cloning, you have to work within the folder itself

  • No amount of trying to add the folder I cloned seemed to cause the thing to be sta= ged. You have to work where the .gitignore file is.


No comments:

Post a Comment