Mac Terminal Git Plugin

broken image


During development of Node.JS, you may need to clone a GitHub reposity to local mac computer. A repository on GitHub is a remote repository. You can clone the repository to your mac computer in order to create a local copy and sync between the two locations.

  1. My Versions: Mac High Sierra; git version 2.14.3 (Apple Git-98); Python 2.7.10. OK, by default, when you have a new mac, your Terminal.app will look something like below. Let's go ahead and add Themes, fonts, and so on. Step 1 — Add A New Theme. The first obvious step is to enhance the Theme.
  2. How to use Git and GitHub on Mac: What are Git and GitHub? Open Terminal and enter git -version. If you see git version followed by numbers, i.e., git 2.5.4 then you are good to go.

EGit is the Git integration for Eclipse. Git is a distributed versioning system, which means every developer has a full copy of all history of every revision of the code, making queries against the history very fast and versatile. The EGit project is implementing Eclipse tooling on top of the JGit Java implementation of Git. Open Terminal on your mac. You can do this by openning Launchpad and search for Terminal. Once it's opened, you can right-click the Terminal icon in dock and choose 'Options Keep in Dock' so that you can open it directly from dock next time. Type cd and the directory where you want the cloned directory to be made. Open Terminal.app 'cd' to directory; cd path/to/directory Initiate a git repository; git init. Add existing files; git add. Commit all files (-a) and add a message (-m) git commit -a -m 'commit message goes here' Cloning (checking out) someone else's repository with the Github for Mac.

1. Open the main page of the repository in browser. click Clone or download.

2. Click the Copy icon to copy the clone URL for the repository.

3. Open Terminal on your mac. You can do this by openning Launchpad and search for Terminal. Once it's opened, you can right-click the Terminal icon in dock and choose 'Options > Keep in Dock' so that you can open it directly from dock next time.

4. Type cd and the directory where you want the cloned directory to be made. You can right-click the folder in Finder and choose 'Copy ' to copy the path into clipboard. Then by pressing 'Command' and 'v' on your keyboard to paste the path into terminal.

5.Type 'git clone', and then paste the URL you copied in step 2. Press Enter. The local clone will be created.

Creating a new code repo from a local working copy

with the Github for Mac app

  1. From the repositories view in the app, drag the project folder to the bottom of the left sidebar.
  2. Hit 'Yes' when it asks if you want to create a local git repository
  3. Go to 'Changes' view (⌘2)
  4. Select the files that you want to commit their current state to the repository. You can view the changes of the file by clicking on the double up arrow on the file name bar.
  5. Type a commit summary, usually a description of what you've just added or changed.
  6. Click 'Commit'. This commits the current state of the code to your local repository. Do this every time to do something significant like fix a bug or develop a feature. Commit early and often. Each state of code is available to you at any time via the History view (⌘1).

with the command line

  • Open Terminal.app
  • 'cd' to directory
Git
  • Initiate a git repository
  • Add existing files
  • Commit all files (-a) and add a message (-m)

Cloning (checking out) someone else's repository

with the Github for Mac app

Setup Git On Mac

  • Visit the repo on Github.com and click the 'clone to Mac' button, or...
  • Select the repo in the Repositories list within the app, under the cremalab account.

with the command line

  • 'cd' to desired directory
  • clone the repo with the clone url

Syncing repository branches with a remote repository

with the Github for Mac app

  1. Make sure you have committed the current state of your code
  2. Drill into your repo in the app and click Sync Branch in the upper right corner. This pulls down the latest code from the remote repository, merges your code with it, and pushes your changes to the remote repository.

Mac Terminal Git Plugin Commands

If you only want to get the latest code from the remote repo, select Repository > Pull (⇧⌘P) from the menu bar. This merges the remote code with your local code but does not push up your changes.

If you only want to push up your current state to the remote reop, select Repository > Push (⌘P). This will only work if you already have the most up to date code from the repo.

with the command line

  • Make sure you have committed your current state.
  • Get the most up to date code from the remote repo
  • Push your local code to the remote repo




broken image