Git - Remove Tracking Branches that are no longer on remote

The remote tracking branches may still exist in your local after a feature branch is merged(to a main branch) and deleted from remote (the normal pull request workflow) The corresponding local branches too may exist and pile up locally, if you are too lazy to delete them. Is there a way to use the information available on remote (say only main branch exists on remote (the longest living branch.)) -...

June 28, 2022 · 2 min · Anant

Day8 #100DaysOfCode

Now extend the fetching from MongoDB to Individual page (dynamic page) of next. On the same dynamic page, the URLs also we will get from the DB (GSPa) Both of these to be done in dynamic page [ ] fetching URLs for GSPa export async function getStaticPaths() { const uri = `mongodb+srv://${secret.user}:${secret.pass}@cluster0.xf7jy.mongodb.net/myFirstDB?retryWrites=true&w=majority`; const client = await MongoClient.connect(uri); const db = client.db(); const notesCollection = db.collection("notesColl2"); const notesIds = await notesCollection.find({}, { _id: 1 })....

May 14, 2022 · 3 min · Anant

Day7 #100DaysOfCode

In last post MongoDB was set up - able to store data from a form. Redirecting to homepage after successful form submit. Use useRouter to do it: In pages/new-note/index.js import { useRouter } from 'next/router' .. const router = useRouter(); // as usual, hook should be called first in react functional component //after successful response of submit router.replace("/"); // or push() Getting data from mongoDB We could do it like, in page component GSP write a connection to our API route > that API route connects to mongoDB i....

May 14, 2022 · 2 min · Anant

Day6 #100DaysOfCode

Day 6 Using mongoDB in the nextjs app. So far covered: getStaticProps, and getStaticPaths and getServerSideProps They allow us to fetch data for pre-rendering those pages, So that we pre-render the pages with the data, instead of without the data they might need. Upto this point, we’re only working with dummy data though (not actually fetching from anywhere) - it is actually hard-coded data We do have this Add New Meetup page here, which would allow users to enter data for a new meetup....

May 11, 2022 · 6 min · Anant

Day5 #100DaysOfCode

Day 5 Key learnings: React hooks like useRouter cant be used in GSP (getStaticProps) - it can only be used in React function component. So can’t use useRouter to get the slug (like ID of note/post). But we dont need it - we have context param in GSP. In GSP the context will not hold req and res - it has params: the params object has key = the thing between [] in the filename....

May 10, 2022 · 4 min · Anant