More notes on Git

Last updated on 29 Oct. 2024
Older notes:
  1. Notes: Git & GitHub: In project with main branch deployed to hosting site, using newfeature git branch for development and eventual merging into main branch, https://raviswdev.blogspot.com/2024/06/notes-git-github-in-project-with-main.html
  2. Solving syncing issue with local git (branch master) after choosing license while making new public repo on Github (branch main); More git trials, https://raviswdev.blogspot.com/2024/04/solving-syncing-issue-with-local-git.html
  3.  Git section in Learning Full Stack (MERN) Web App Development through Free Online Tutorials – Organized Notes and Log, https://raviswdev.blogspot.com/2024/03/learning-web-app-development-through.html#git
-------
To clone only a specific branch:
git clone -b <branchname> --single-branch <remote-repo-url>
---

To check if remote is ahead of local branch, I think I need to do following:
Run 'git remote update'
Then run 'git status' (or 'git status -uno')
-----
==================

git pull error if package-lock.json gets updated by npm install for project which has been earlier cloned or pulled from GitHub but on which no development changes have been made: 
error: Your local changes to the following files would be overwritten by merge:
        package-lock.json
Please commit your changes or stash them before you merge.
Aborting
---

One solution that works for me: Discarding all changes made to packagelock.json and then running 'git pull' again.
Then one can run npm install (which I think would install only required packages, if any), followed by npm start to run the app.

======================

Comments