<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Pearl Mody on Medium]]></title>
        <description><![CDATA[Stories by Pearl Mody on Medium]]></description>
        <link>https://medium.com/@modypearl05?source=rss-2aacfb15e22a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*M5k0prY5nGHzikRK</url>
            <title>Stories by Pearl Mody on Medium</title>
            <link>https://medium.com/@modypearl05?source=rss-2aacfb15e22a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 15:28:23 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@modypearl05/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Lost in Translation: How Multimodal In-Context Learning Can Power Cultural Transcreation]]></title>
            <link>https://medium.com/@modypearl05/lost-in-translation-how-multimodal-in-context-learning-can-power-cultural-transcreation-91042b2675f8?source=rss-2aacfb15e22a------2</link>
            <guid isPermaLink="false">https://medium.com/p/91042b2675f8</guid>
            <category><![CDATA[machine-translation]]></category>
            <category><![CDATA[multimodal]]></category>
            <category><![CDATA[chain-of-thought]]></category>
            <category><![CDATA[transcreation]]></category>
            <category><![CDATA[in-context-learning]]></category>
            <dc:creator><![CDATA[Pearl Mody]]></dc:creator>
            <pubDate>Fri, 24 Oct 2025 20:17:42 GMT</pubDate>
            <atom:updated>2025-10-24T20:17:42.614Z</atom:updated>
            <content:encoded><![CDATA[<p>$10 million! That’s a huge price HSBC had to pay to undertake a rebranding campaign, after they found that the translation of their global advertising slogan “Assume Nothing” was interpreted as “Do Nothing” in several countries. Similarly, Pepsi’s tagline “Come Alive with Pepsi Generation” was translated as “Pepsi brings your ancestors back from the dead” in China, forcing the company to abandon the campaign and incur associated losses due to the failure in brand messaging. This alone shows that word to word translation is not enough , we need to step above it to preserve the context and intention of the statement.</p><p>Nowadays, the vast corpus of data is no longer limited to text; it’s often multimodal. In such cases, to preserve the intent and emotional meaning of the content, the solution lies in transcreation. No wonder an image of families gathered around a Thanksgiving table resonates in the US, while in India, the same emotion comes alive through the glow of diyas and families sharing sweets on Diwali night. Thus, while translating literature from one language to another, we can intentionally adapt it to resonate with the target audience. For instance, Indian children may connect more with a grandmother dressed in traditional Indian attire, whereas Spanish children would relate better to a setting that reflects their own culture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w6ZtGTakih1AEHDZ6-lm_g.jpeg" /><figcaption><em>Ai transcreated image (</em>First image sourced from Children’s Stories on <a href="https://storyweaver.org.in/en/student">Story Weaver.</a><em>)</em></figcaption></figure><p>In this article, I explore recent work on transcreation and offer my own perspective on how some of its key challenges could be approached.</p><h3>Transcreation</h3><p>Recent research from Carnegie Mellon University, presented in the paper <em>“</em><a href="https://arxiv.org/pdf/2404.01247"><em>An Image Speaks a Thousand Words, but Can Everyone Listen? On Image Transcreation for Cultural Relevance</em></a><em>”,</em> explores different ways to perform transcreation. The first approach uses the state-of-the-art model <em>InstructPix2Pix ,</em> which worked well in simple cases but the results revealed that it lacked cultural understanding and often produced stereotypical outputs. This could be due to its limited grasp of cultural context, for instance, when asked to make an image relevant to Japan, it might simply associate everything with cherry blossoms. To address this lack of cultural understanding, the next two approaches leveraged the capabilities of large language models in the process of transcreation. The second approach is <em>cap-edit: Caption, text-edit, image-edit,</em> where the image was captioned by using <a href="https://huggingface.co/Salesforce/instructblip-flan-t5-xxl"><em>InstructBLIP-FlanT5-XXL</em></a> model, and then the caption was edited using a simple prompt to LLM (GPT-3.5), and the result was used in editing the image according to the new caption. This worked pretty well, but again it had errors, and the orientation of certain objects in the image was not maintained. The Third approach is <em>cap-retrieve: Caption, edit, retrieve</em>, where the generated caption, after being edited by LLM, is used as a query to a large database of images to find the most relevant match. While this method is promising, some of its limitations might be linked to what I refer to as the <em>unimodal trap</em>.</p><h3>Unimodal Trap</h3><p>Despite being multimodal in nature, most of these models struggle to fully incorporate visual cues. This is what I call a unimodal trap. This phenomenon occurs when a multimodal model defaults to text based pattern matching, largely ignoring visual context, and attempts to apply simple text-to-text substitutions it learned during pretraining. For example, a task is given to transcreate an image of a lynx in a storybook to an Indian context. The model, falling into this trap, captions the image as “a lynx,” then its internal LLM edits that caption to “a tiger” simply because “lynx” + “India” is textually substituted with the high-probability word “tiger”. The model is then instructed to “replace the lynx with a tiger”. This process completely ignores the visual cues (e.g., that the lynx might be in a snowy, mountainous environment, which is nonsensical for a tiger) and results in an “unnatural looking output” because it was just a text-based substitution, not true multimodal reasoning. To address this, the research paper <em>“</em><a href="https://openreview.net/pdf?id=n4JdyBGu6T"><em>True Multimodal In-Context Learning Needs Attention to the Visual Context</em></a><em>”</em> proposes that frameworks like DARA(Dynamic Attention ReAllocation) can help overcome this limitation by explicitly attending to visual information. It introduces a lightweight approach where a set of learnable attention-balancing parameters is added to focus more effectively on visual context.This mechanism could be integrated into current VLMs to enhance their ability to attend to visual context and improve overall performance.</p><p>In the above approaches, failures also tend to occur, particularly when cultural adaptation requires subtle context or there are fewer resources on a particular culture. This is often because the methods rely on zero-shot prompting. To address this, I suggest that Multi-Modal In-Context Learning(MICL) could be a potential approach.</p><h3>In-context Transcreation with CoT</h3><p>Leveraging MICL, I introduce the idea of <em>In-Context Transcreation (ICT)</em> as a possible direction for more culturally grounded multimodal understanding. So in this approach, we can use few shot prompting in place of zero shot for a deeper understanding of cultural context. In other words, the model should be prompted with examples of desired cultural transformation, like you can provide the model with examples like &lt;US_image&gt; -&gt; &lt;Indian_image&gt;, you are implicitly asking it to solve for ‘X’ in the equation: US_image + X = Indian_image. Here, ‘X’ is the abstract visual transformation operator. It’s not a single action, but a complex set of visual, semantic, and stylistic changes that represent the “cultural distance” between the two contexts for a given concept. The model is forced to deconstruct the visual differences between the example pairs to understand this operator. To improve on this further, we can introduce a chain of thought(COT) reasoning step. This intermediate reasoning layer can capture the cultural logic behind the transformation (e.g., “A US hot dog is a common street food. The Nigerian equivalent is Suya, which are grilled meat skewers.”). This makes the model’s process more transparent and controllable. The image below depicts the architecture I propose, where the key difference from earlier approaches is the inclusion of in-context learning combined with chain-of-thought reasoning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*PbTxH3f5mxF0W29VfQKMNg.jpeg" /><figcaption><strong>In-context Transcreation using Chain of Thought Reasoning</strong></figcaption></figure><blockquote>Caption Generator -Uses InstructBLIP-FlanT5-XXL to generate a caption from an image</blockquote><blockquote>Transcreator — LLM that edits captions using a detailed, example-driven prompt with reasoning.</blockquote><blockquote>Image Generator — A powerful VLM that edits and generates an image from the edited caption while precisely following instructions to preserve object positions and orientations from the original image.</blockquote><h3>Proof Of Concept</h3><p>The following script demonstrates a practical implementation of the ICT-CoT framework. In this script, I have illustrated the process up to the transcreator stage; beyond this, any plug-and-play image generation model can be integrated to produce the final image.</p><pre>import torch<br>import requests<br>from PIL import Image<br>from transformers import InstructBlipProcessor, InstructBlipForConditionalGeneration<br>from langchain_groq import ChatGroq<br>from langchain_core.prompts import ChatPromptTemplate<br>from dotenv import load_dotenv<br>import os<br><br># Load environment variables from .env file<br>load_dotenv()<br><br>def load_model_and_processor(model_name):<br>    print(f&quot;Loading model: {model_name}...&quot;)<br>    processor = InstructBlipProcessor.from_pretrained(model_name,use_fast=True)<br>    model = InstructBlipForConditionalGeneration.from_pretrained(<br>        model_name, <br>        dtype=torch.bfloat16<br>    )<br>    device = &quot;cuda&quot; if torch.cuda.is_available() else &quot;cpu&quot;<br>    model.to(device)<br>    print(f&quot;Model loaded and moved to {device}.&quot;)<br>    return model, processor, device<br><br>def caption_generator(model, processor, device, image_url):<br>    print(f&quot;Loading image from: {image_url}&quot;)<br>    try:<br>        raw_image = Image.open(requests.get(image_url, stream=True).raw).convert(&quot;RGB&quot;)<br>    except Exception as e:<br>        print(f&quot;Error loading image: {e}&quot;)<br>        return None<br><br>    caption_prompt = &quot;Provide a detailed description of what is happening in this image.&quot;<br><br>    inputs = processor(<br>        images=raw_image, <br>        text=caption_prompt, <br>        return_tensors=&quot;pt&quot;<br>    ).to(device, dtype=torch.bfloat16)<br><br>    print(&quot;Generating original caption...&quot;)<br><br>    outputs = model.generate(<br>        **inputs,<br>        max_new_tokens=100,  <br>        min_length=10<br>    )<br>    <br>    caption = processor.batch_decode(outputs, skip_special_tokens=True)[0].strip()<br>    return caption<br><br><br>def transcreate_text(caption_to_transcreate):<br>    print(&quot;\n--- Sending Transcreation Prompt to Groq via LangChain ---&quot;)<br>    llm = ChatGroq(<br>        model=&quot;llama-3.3-70b-versatile&quot;,<br>        temperature=0.7<br>    )<br><br>    transcreation_prompt = ChatPromptTemplate.from_messages([<br>        (&quot;system&quot;, &quot;&quot;&quot;You are an expert in cultural transcreation, specializing in adapting any contexts to modern Indian contexts. <br>Follow the reasoning from previous examples and adapt cuisine, festivals, activities, and idioms appropriately.&quot;&quot;&quot;),<br>        (&quot;user&quot;, &quot;&quot;&quot;<br>Here are a few examples of how you should reason and respond:<br><br>Example 1:<br>Input: &quot;A family is eating pancakes for breakfast.&quot;<br>Reasoning: Pancakes are an American breakfast. Common Indian breakfast items include dosa or idli. Replace accordingly.<br>Output: &quot;A family is eating dosas and idli for breakfast.&quot;<br><br>Example 2:<br>Input: &quot;They are carving a large turkey for the Thanksgiving feast.&quot;<br>Reasoning: Thanksgiving is an American holiday. In India, Diwali is widely celebrated. Replace the context appropriately.<br>Output: &quot;They are opening boxes of sweets like kaju katli for the Diwali celebration.&quot;<br><br>Example 3:<br>Input: &quot;People are watching a parade of floats during a Japanese festival.&quot;<br>Reasoning: The input describes a Japanese matsuri festival, where people watch decorative floats. In India, a similar vibrant celebration would be a procession during Ganesh Chaturthi or Navratri. I will adapt the Japanese festival setting to an Indian one.<br>Output: &quot;People are watching a colorful procession during the Ganesh Chaturthi festival.&quot;<br>         <br>Example 4:<br>Input: &quot;Children are playing soccer in an open field after school.&quot;<br>Reasoning: Soccer is the most popular sport in Mexico, often played casually by kids. In India, the equivalent widespread and beloved sport would be cricket. I’ll replace &#39;soccer&#39; with &#39;cricket&#39; while keeping the school and open-field setting intact.<br>Output: &quot;Children are playing cricket in an open field after school.&quot;<br><br>Now, based on input. First figure out the country it is from , then apply propper reasoning and convert every element in the image to indian context and give the perfect response.If it is already in indian context,do not make any changes.<br>Input: &quot;{caption_to_transcreate}&quot;<br>Reasoning and Final Output:<br>&quot;&quot;&quot;)<br>    ])<br><br>    chain = transcreation_prompt | llm<br>    result = chain.invoke({&quot;caption_to_transcreate&quot;: caption_to_transcreate})<br>    return result.content.strip()<br><br>def main():<br>    if not os.getenv(&quot;GROQ_API_KEY&quot;):<br>        print(&quot;Error: GROQ_API_KEY not found in .env file!&quot;)<br>        print(&quot;Please create a .env file with: GROQ_API_KEY=your_api_key_here&quot;)<br>        return<br><br>    MODEL_NAME = &quot;Salesforce/instructblip-flan-t5-xxl&quot;<br>    IMAGE_URL = &quot;https://as1.ftcdn.net/jpg/01/06/67/76/1000_F_106677691_vdOTRk9ZIm9yT3GlI5zDL79x38OpizlT.jpg&quot;<br>    <br>    try:<br>        model, processor, device = load_model_and_processor(MODEL_NAME)<br>    except Exception as e:<br>        print(f&quot;Failed to load model. Do you have enough VRAM/RAM? Error: {e}&quot;)<br>        return<br><br>    original_caption = caption_generator(model, processor, device, IMAGE_URL)<br>    <br>    if original_caption:<br>        print(&quot;\n&quot; + &quot;=&quot;*50)<br>        print(f&quot;Original Caption Generated:\n{original_caption}&quot;)<br>        print(&quot;=&quot;*50 + &quot;\n&quot;)<br>    else:<br>        print(&quot;Failed to generate caption. Exiting.&quot;)<br>        return<br><br>    transcreation_result = transcreate_text(original_caption)<br><br>    print(&quot;\n&quot; + &quot;=&quot;*50)<br>    print(&quot;Transcreation Successful&quot;)<br>    print(&quot;=&quot;*50)<br>    print(f&quot;\nReasoning:{transcreation_result}&quot;)<br><br>if __name__ == &quot;__main__&quot;:<br>    main()</pre><h3>Output:-</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3r7Wbsc_B4aL5DD0cF6DAA.png" /></figure><pre>Output:-<br>(myenv) pearl@AI-WS12:~/Desktop/transcreation$ python main.py<br>Loading model: Salesforce/instructblip-flan-t5-xxl...<br>Loading checkpoint shards: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 5/5 [00:02&lt;00:00,  2.15it/s]<br>Model loaded and moved to cuda.<br>Loading image from: https://as1.ftcdn.net/jpg/01/06/67/76/1000_F_106677691_vdOTRk9ZIm9yT3GlI5zDL79x38OpizlT.jpg<br>Generating original caption...<br><br>==================================================<br>Original Caption Generated:<br>The image depicts a hot dog cart with a variety of hot dogs and condiments. The cart is positioned on a white background, with the hot dogs and condiments positioned on the cart and on the ground. The hot dogs are arranged in a line, with two hot dogs located in the middle and two hot dogs located on the sides. The condiments are also arranged in a line, with two condiments located in the middle and two condiments<br>==================================================<br><br><br>--- Sending Transcreation Prompt to Groq via LangChain ---<br><br>==================================================<br>Transcreation Successful<br>==================================================<br><br>Reasoning:The input describes a scene with a hot dog cart, which is a common food vendor setup in the United States, particularly at events, streets, or festivals. To transcreate this into an Indian context, I need to replace the elements with their Indian equivalents.<br><br>Reasoning:<br>1. **Replace the hot dog cart with an equivalent Indian street food cart**: In India, a popular street food cart might sell items like vada pav, pani puri, or chaat items. Let&#39;s replace the hot dog cart with a vada pav cart, as vada pav is a widely recognized and beloved street food in India.<br><br>2. **Replace hot dogs with vada pav**: Hot dogs are the main item being sold from the cart in the original scenario. In the Indian context, vada pav (fried doughnut-like snack served in a bread bun) will be the main item.<br><br>3. **Replace condiments with appropriate Indian condiments**: Common condiments for hot dogs include ketchup, mustard, and relish. For vada pav, typical accompaniments include chutneys like green chutney or tamarind chutney, and sometimes a fried green chili.<br><br>4. **Maintain the setting and arrangement**: The description mentions the cart on a white background with items arranged in a line. This setting can remain the same as the focus is on replacing the items being sold and their accompaniments, not the aesthetic arrangement.<br><br>Final Output:<br>&quot;The image depicts a vada pav cart with a variety of vada pav and chutneys. The cart is positioned on a white background, with the vada pav and chutneys positioned on the cart and on the ground. The vada pav are arranged in a line, with two vada pav located in the middle and two vada pav located on the sides. The chutneys are also arranged in a line, with two chutneys located in the middle and two chutneys located on the sides.&quot;<br>(myenv) pearl@AI-WS12:~/Desktop/transcreation$ ^C</pre><p>In this example for demonstration purposes, an <a href="https://as1.ftcdn.net/jpg/01/06/67/76/1000_F_106677691_vdOTRk9ZIm9yT3GlI5zDL79x38OpizlT.jpg">image of a hotdog</a> cart was given, and it was told to transcreate to the Indian context. The above screenshot shows the output generated after the image is passed through the proposed script.</p><p>Conclusion</p><p>Transcreation plays a vital role in making education, stories, and entertainment accessible across diverse cultures. It goes beyond literal translation, enabling effective translation of multimodal data. While recent approaches show promising results, they often struggle with visual integration, falling into the ‘unimodal trap.’ The proposed In-Context Transcreation (ICT) framework, which leverages Chain-of-Thought (CoT) reasoning and few-shot prompting, offers a robust solution for deeper multimodal understanding. Extensive research has explored evaluating transcreated images using AI and human collaborative methods, yet cultural meaning remains deeply nuanced and can vary across individuals. By leveraging AI–human collaboration and advanced evaluation techniques, these challenges can be effectively addressed, enabling transcreation systems to better reflect the diversity of cultural interpretations.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=91042b2675f8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering Git and GitHub: A Step-by-Step Guide for Beginners]]></title>
            <link>https://medium.com/@modypearl05/mastering-git-and-github-a-step-by-step-guide-for-beginners-a33e57ef760b?source=rss-2aacfb15e22a------2</link>
            <guid isPermaLink="false">https://medium.com/p/a33e57ef760b</guid>
            <category><![CDATA[collaboration]]></category>
            <category><![CDATA[contribution]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[hacktoberfest]]></category>
            <category><![CDATA[git-github]]></category>
            <dc:creator><![CDATA[Pearl Mody]]></dc:creator>
            <pubDate>Sat, 28 Sep 2024 12:16:19 GMT</pubDate>
            <atom:updated>2024-09-28T12:16:19.923Z</atom:updated>
            <content:encoded><![CDATA[<p>Open Source collaboration has become increasingly popular and with hacktober fest approaching it’s all in demand. Whether you are participating in Hacktoberfest or you just want to collaborate on your own project with others , knowing git and GitHub is essential. So in this guide I will break down the concept of Git ,GitHub and Open source from a beginner’s level.</p><p>What is git ?</p><p>Git is a version control system. Version Control system helps you track your code over time and collaborate with others. It helps you to revert to previous versions as it keeps “snapshots” of your files . So you can access a particular snapshot or the specific part of the code that you had previously written or edited.These snapshots are nothing but commits which is explained below. Git does not require a particular language or framework.It can be used for any type of projects such as static html,websites,nodejs,flutter projects etc.It is also called distributed version control which means you can collaborate and work without being on same network.It stores your repositories locally which you can further push it to remote storage at github.</p><p>What is Github?</p><p>Github is a cloud based platform to store and manage all your repositories remotely.In simple terms github provides you the space to keep your projects safe and accessible from anywhere.You can push your local repositories to github or pull the files from the repositories to collaborate smoothly with others.</p><p>Git Key Concepts and Commands:-</p><p>So you can start working on git simultaneously as you read the following commands. First you need to install git .Open your terminal in your vs code and type the following starting commands:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*20G-D-04SOhHuFS6" /></figure><p>The first command: git config — global user.name “[firstname lastname]”</p><p>makes the name as the author so every commit you make will be labeled as authored by firstname lastname.</p><p>The second command :git config — global user.email “[email]”</p><p>This associates the email you provide with the commits.</p><p>The Third command: git config — global color.ui auto</p><p>This command enables Git to automatically display colored output in your terminal or command line for easier readability.</p><p>The — global flag applies the configurations system-wide (for that user), meaning you only need to set them once, and Git will use those settings for all repositories on that system unless overridden.</p><p>If you omit the — global flag, Git applies the configuration only for the current repository, allowing you to override the global settings for that specific project.</p><p><em>Repositories can be considered like a storage container.Git Repositories store all your code files in a systematic manner.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/333/0*UzPuinoOYN5nkvVZ" /></figure><p>Navigate to the folder where you want to initialize the repository.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/179/0*an9FiYkSDmQXHVu-" /></figure><p>git init : initializes a new git repository in your current directory.It creates a hidden .git directory in your current folder which keeps all the data of your configurations,commit history i.e. who made changes when etc.</p><p>Now open Github and make an account you will see the create new repository option in green below:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/0*S6sKTmW1LSeApg9K" /></figure><p>After that there will be an option to name the repository and then add a readme file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WmXRFaA3GYvAMFxG" /></figure><p>Then copy the link which you can see in the code option .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/382/0*auM8BK1Ob6x63zcP" /></figure><p>Run this command on your terminal . This command connects your local repositories with your remote repository on github.</p><p>Git manages local repositories and github manages remote repositories.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/219/0*9MFrd9sNIidvFMYt" /></figure><p>This command verifies the remote repository connection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/990/0*VHKpxqQgMvDce5mz" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/405/0*sTeDjWqFh9a0cdZx" /></figure><p>The git add command adds changes (new files, modified files, or deleted files) to the staging area. This means the changes are prepared to be included in the next commit, but they are not yet committed to the repository.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/424/0*up4nOZLdbGBe8f0a" /></figure><p>This command takes a ‘snapshot’ of your code and all the code which is staged till this point is saved.This command enables you to choose the point till which you want to have the snapshot of your code.We generally provide meaning full messages or description of the task eg:-“added express validators .</p><p>Note: Till this point all your code is recorded in local directory you need to push it to github to access it remotely by the following command:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/353/0*dCej9wcC475oTNNW" /></figure><p>This command uploads your commits to the remote repository on the master branch.</p><p>Git allows the concept of branching where it allows you to create independent branches of development within a repository.</p><p>You can leave a branch and switch to a new one by using command:- <strong>git checkout main</strong></p><p>This command switches the branch to main and then u can merge all the changes of that branch to main by git merge.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/345/0*1YmvLT0sxoN4eU0L" /></figure><p><strong>.gitignore File</strong></p><p>Create .gitignore file in the VS code to tell git about which files or folders have to be ignored.We usually ignore files that are large and not required to be uploaded to our repository.Git will not track files and folders in gitIgnore.Example if we want to ignore temporary files,personal files or .log files we will put the name of these files in fine named “.gitignore”.In practice we ignore large bulky third party files such as Node Modules which are present in “node_modules” directory. It contains all the dependencies required for node.js projects.We also ignore database files which are with *.db , *.sqlite-like files to prevent accidental commits of sensitive information or large data.Other common files that we ignore are “.env” files and build files.</p><p><strong>Git Logs</strong></p><p>Git Logs gives the list of all the commits that you have made from the begining.By default, the command displays each commit’s Secure Hash Algorithm (SHA) , author , date and commit message.</p><p>Important git log commands are:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/490/0*CPuAA_uYrQ0M1wFS" /></figure><p>git log:- displays the entire log of all the commits in a comprehensive manner.</p><p>git log — -oneline: Displays all the commits in a concise way including hash and a subject line in a single line.</p><p>git log — -graphs : Gives the visual summary of commit history in form of graph showing branches and merging clearly.</p><p>git log — -author =&lt;author_name&gt; : Logs commit only by a specific author</p><p>git log -p:This gives all the logs with differences from each commit showing exactly what lines were added, modified or deleted.</p><p>git log — stat: Adds file by file summary of changes showing number of lines deleted and added.</p><p><strong>Git Revert</strong></p><p>Git revert is used to revert to a previous commit. It is a non destructive and safe method as it does not delete or alter existing commit history,it does so by creating a new commit which has all the code till your previous commit which you had chosen.for example :- if you git log — -oneline will show you all the commits you have made eg:-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/519/0*I3_Fjudg7aO5SnMF" /></figure><p>Now if you want to undo everything and go to “4f5e6d7 profile page layout”</p><p>So you will use git revert&lt;4f5e6d7&gt;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/479/0*RoPGaAPg__oG8RLA" /></figure><p>So after this in VS code will open a new tab with the pre-filled commit message for the revert. You can either:</p><ul><li><strong>Accept the default message</strong> by simply saving and closing the file. To do this, press Ctrl+S to save, then close the tab.</li><li><strong>Edit the message</strong> if you want to provide more details before saving and closing.</li></ul><p>If you type command “git revert -m &lt;commit-hash&gt;” this will skip the editor part and apply the default message.</p><p>After following above steps git log --oneline will show you this output, where a new commit is made which has all the code till commit “4f5e6d7 profile page layout” and commits are as it is.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/526/0*YT1ooUZtNhxSlhc0" /></figure><p>Some other ways to use revert:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/0*yQOT_MaI3hc0iQqm" /></figure><p><strong>Git Reset</strong></p><p>Git reset command is used to move the current branch (where all commits are being made) to a specific previous commit. It is different from revert as it alters the commit history, meaning it removes all the commits from the current commit(HEAD) till the desired commit. It is advised to be careful while using this command as it rewrites the commit history. It is generally used while working on local projects or private branches as others commits might also be removed. There are two types of git reset :-</p><p>1)<strong>Soft Reset</strong></p><p>It moves the current branch to the desired commit(which is specified in the hash).It keeps the unstaged part in the working directory as it is, i.e. all the files or lines of code added before “git add.” remain in the working directory and it removes all the commits from the last till the specific commit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/589/0*2YUe3WKHuHWfZiiZ" /></figure><p>2)<strong>Hard Reset</strong></p><p>It also moves the current branch to the desired commit but it also removes the unstaged part and overwrites the working directory. In other words it moves the head to the the desired commit,clears the staging area,and clears all the commits from HEAD till the desired commit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/579/0*fP-RuwNw3oY2GHu2" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/0*gu5C-Bc8JibYQYPl" /></figure><p>=&gt;You can also undo git reset if you know the particular hash by “git reset &lt;hash-value&gt;” this is possible because even if the commit is not present in your git log it is temporarily present in ‘reflog’ of git . This ‘reflog’ stores data until git periodically performs garbage collection .</p><p><strong>Git Pull and Push</strong></p><p><strong>Git pull:-</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/583/0*elBW5nvFthYFB7Mq" /></figure><p>This command pulls all the files and commits from the remote repository and merges them to the local branch.</p><p><strong>Git push:-</strong></p><p>As seen earlier it pushes all the files/folders from the local repository to the remote repository.It is done by command “git push origin master”, here master is the name of the branch .</p><p><strong>Bonus Git Shortcut</strong></p><ul><li>Instead of :-</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/592/0*yKulTavB3kKyPl-U" /></figure><p>You can use:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/582/0*aNDIwagGY6zqNXUs" /></figure><ul><li>git allows aliases which means we can rename the commands ie:-</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/633/0*W38fkKmu5csvRjBi" /></figure><ul><li>Git also allows you to rename commits by “git commit –amend -m “Edited message”</li></ul><p><strong>Git Fork</strong></p><p>In git you cannot edit other programmer’s repositories unless you have been given access to do so.In this case you fork i.e. copy the repositories from somebody’s remote repository to your remote repository. By forking a person can create independent copies of the repositories.This is usually done during open source contributions and collaborations where you take a remote copy of the repo in your github.It can also be used when you have a project where you want to see the outcomes and errors without making changes in the project.</p><p><strong>How to Fork a repository?</strong></p><p>This is done by opening the repository which you want to fork , below the top right header you will see:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/653/0*YWI77BvVn7iL2-wr" /></figure><p>On clicking the fork and following the steps you can fork the repository in your own github account.</p><p><strong>Git Clone</strong></p><p>Git clone is used to fetch all the files from the repository where you have forked all the files to the local repository. It clones all the files to the local repo where you can edit, alter,add features and enhance the code.It can create a copy of a specific repository or the branch whatever you choose.Once you clone a repo you can make as many changes you want on your local device then stage the changes and commit them in your local repository. You can also push these changes to your own repository(which is forked) and then send pull requests so the creator of the repo gets your request and can evaluate whether to accept it or not.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/0*xfAdQ4LBlUefsUBH" /></figure><p>The link is found after clicking on the code button.The link should be copied and pasted on the terminal to clone the repository.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RCcz5q7mPCGtTaiF" /></figure><p>Now you know all the basics of git and github.There are many other tools which provide different features but the most common is git and github.</p><p><strong>What is Open Source?</strong></p><p>Open-source projects are quite popular these days but you might wonder what actually is open source? Open source is freely available original source code of a software project. It is readily available to the public in contrast to proprietary software which is confidential and is managed and controlled by a developer or a company.These codes are present in public repositories which can be forked and cloned.This feature enables us to to view,use ,modify and distribute the code.</p><p>The two popular open-source events are :-</p><ol><li>GSOC :- Google Summer of Code (GSoC).This is held by google.</li><li>Hacktoberfest:-Which occurs every year in the month of october from 1st october to 31st october which is on a global level organized by Digital Ocean. This fest requires the programmers to submit four valid pull requests on any of the GitHub repositories provided by them. Now that you’ve gained a solid understanding of Git, GitHub, and open source, you’re ready to put your skills into action!</li></ol><p>Here’s a step-by-step guide to get started:</p><p>1. Choose a repository from the approved list.<br>2. Fork the repository to your remote GitHub account.<br>3. Clone the forked repository to your local machine.<br>4. Make necessary changes, improvements, or contributions.<br>5. Send pull requests to the original repository.</p><p><strong>Why do you need to contribute to opensource?</strong></p><ul><li><strong>Real world learning:- </strong>While working on open source projects you get the opportunity to work on a complex code base which will help when you work on real life companies.</li><li><strong>Internship Offers:- </strong>Some companies do give internship offers based on your open-source contributions during GSOC.</li><li><strong>Networking</strong> :- During open-source events you tend to network with new people which helps you to learn new things which you might not get to know normally.</li><li><strong>Enhances your programming skills</strong></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a33e57ef760b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>