<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Junaid Anwar</title>
    <description>The latest articles on DEV Community by Junaid Anwar (@juni).</description>
    <link>https://dev.to/juni</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F33855%2F3abe77d6-d664-4c69-b1e3-df70d8730692.jpg</url>
      <title>DEV Community: Junaid Anwar</title>
      <link>https://dev.to/juni</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/juni"/>
    <language>en</language>
    <item>
      <title>How to export and import MongoDB collections</title>
      <dc:creator>Junaid Anwar</dc:creator>
      <pubDate>Mon, 04 Sep 2023 09:08:20 +0000</pubDate>
      <link>https://dev.to/juni/how-to-export-and-import-mongodb-collections-4ped</link>
      <guid>https://dev.to/juni/how-to-export-and-import-mongodb-collections-4ped</guid>
      <description>&lt;p&gt;MongoDB is one of the most popular NoSQL databases in the world today, frequently employed in a myriad of applications. One of the common operations users perform on MongoDB is exporting and importing data, which is often vital for tasks like backup, migration, or data analysis.&lt;/p&gt;

&lt;p&gt;In this article, we will walk you through the process of exporting and importing MongoDB collections using MongoDB's official database tools.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prerequisites&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;MongoDB Database Tools:&lt;/strong&gt; Before starting, you need to download MongoDB's official Database Tools. These tools provide the necessary utilities to perform our required operations. Download it from the following link: MongoDB Database Tools.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Installation Path:&lt;/strong&gt; After downloading and installing the tools, remember the path. The default installation path for Windows is usually &lt;code&gt;C:\Program Files\MongoDB\Tools\100\bin&lt;/code&gt;. Either add this path to your system's PATH variable or navigate to this directory each time you want to run the commands.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Exporting MongoDB Collections&lt;/strong&gt;&lt;br&gt;
Exporting allows you to take a snapshot of your data in MongoDB and save it as a backup or for transfer purposes. Here’s how you can export your data:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Open Command Prompt or Terminal:&lt;/strong&gt; Depending on your operating system, open the Command Prompt (Windows) or Terminal (Mac/Linux).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Navigate to the Directory&lt;/strong&gt;: If you haven’t added the tools to your PATH, navigate to the directory where the MongoDB tools are installed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd C:\Program Files\MongoDB\Tools\100\bin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Run the Export Command:&lt;/strong&gt; Use the &lt;code&gt;mongodump&lt;/code&gt; utility to export your data. Here's the generic command to execute:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;./mongodump --uri "mongodb+srv://USERNAME:PASSWORD@DB_URL/DB_URL?retryWrites=true&amp;amp;w=majority" -o "OUTPUT_PATH"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace &lt;code&gt;USERNAME&lt;/code&gt;, &lt;code&gt;PASSWORD&lt;/code&gt;, &lt;code&gt;DB_URL&lt;/code&gt;, and &lt;code&gt;OUTPUT_PATH&lt;/code&gt; with your MongoDB credentials and the desired output directory respectively. It will create a&lt;code&gt;.json&lt;/code&gt; for each collection in the output directory you chosen.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Importing MongoDB Collections&lt;/strong&gt;&lt;br&gt;
Now that we've seen how to export, let’s look at how to import the data back into MongoDB:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Open Command Prompt or Terminal:&lt;/strong&gt; As before, open your command interface.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Navigate to the Directory:&lt;/strong&gt; If not already there, navigate to the MongoDB tools directory.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Run the Import Command:&lt;/strong&gt; Use the mongorestore utility to import your data. Here's the generic command to execute:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;./mongorestore -d production_clone3 "CLONED_DB_PATH"

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Replace &lt;code&gt;production_clone3&lt;/code&gt; with your desired database name and &lt;code&gt;CLONED_DB_PATH&lt;/code&gt; with the path to the directory containing the data dump you want to restore.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
Exporting and importing MongoDB collections is straightforward with the MongoDB Database Tools. These operations are foundational in managing and migrating data, ensuring data safety, and performing backups. Now that you know how to do it, you can confidently manage your MongoDB datasets with ease.&lt;/p&gt;

</description>
      <category>mongodb</category>
      <category>cli</category>
      <category>productivity</category>
      <category>database</category>
    </item>
    <item>
      <title>Install Maven and run Ward monitoring tool on linux server to see server resources consumption in real time</title>
      <dc:creator>Junaid Anwar</dc:creator>
      <pubDate>Mon, 25 Apr 2022 08:14:02 +0000</pubDate>
      <link>https://dev.to/juni/how-to-install-maven-on-linux-server-to-see-server-resources-consumption-in-real-time-2co</link>
      <guid>https://dev.to/juni/how-to-install-maven-on-linux-server-to-see-server-resources-consumption-in-real-time-2co</guid>
      <description>&lt;p&gt;I am trying to install this monitoring tool on my Linux server to see the server resources consumption in real time. &lt;a href="https://github.com/B-Software/Ward"&gt;https://github.com/B-Software/Ward&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;However the documentation is not self explanatory assuming I have no experience with java and jar files before. I am having a hard time setting the tool up.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Here is how I did it&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Install Apache Maven&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;sudo apt update&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;sudo apt install maven&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;mvn -version&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;git clone &lt;a href="https://github.com/B-Software/Ward.git"&gt;https://github.com/B-Software/Ward.git&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;cd Ward&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;mvn clean package&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;cd into the target directory and run &lt;code&gt;java -jar ward-1.8.8.jar&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Open localhost:4000 (or your server's ip followed by :4000)&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Photo by &lt;a href="https://unsplash.com/@firesmini?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Filipe Resmini&lt;/a&gt; on &lt;a href="https://unsplash.com/s/photos/beetle?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>TightVNC too many authentication failures [Resolved]</title>
      <dc:creator>Junaid Anwar</dc:creator>
      <pubDate>Sat, 01 Sep 2018 15:38:45 +0000</pubDate>
      <link>https://dev.to/juni/tightvnc-too-many-authentication-failures-resolved-7m5</link>
      <guid>https://dev.to/juni/tightvnc-too-many-authentication-failures-resolved-7m5</guid>
      <description>&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Folsbp4a19rd8w72xj1px.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Folsbp4a19rd8w72xj1px.png" alt="vnc server the authentication error with too many authentication failures" width="687" height="380"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You want to access ubuntu server with its graphical user interface you install TightVNC or x2go. I installed TightVNC's vncserver in my Ubuntu and was able to access it for a few days and then suddenly saw this: "Authentication reason: Too many authentication failures". That drove me nuts and wouldn't let me in. &lt;/p&gt;

&lt;p&gt;The problem may occur by you, making too many failed attempts to login to vncserver, or it can be bots accessing your server with brute force methods.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Solution:
&lt;/h2&gt;

&lt;p&gt;You will have to kill the vnc process and restart it to gain access to the vncserver again. Connect to your server via ssh and run the following command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pgrep vnc

// the output will look like following but yours will be different (sure thing)
17732
23723
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;You will see one or more process ids that are running against vncserver. Just run the following command for each process id&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kill PID

// In my case I ran the following two since I had two process ids
kill 17732
kill 23723
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Now you have killed TightVNC on your Ubuntu. Turn it on again and you'll be fine to connect again. To make the VNC up and running again, run the following command.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;vncserver -geometry 1920x1080
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkjex2nwtlx5fkm6t2v0l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkjex2nwtlx5fkm6t2v0l.png" alt="vnc server the solution to authentication error with too many authentication failures " width="800" height="284"&gt;&lt;/a&gt;&lt;br&gt;
That's it!&lt;/p&gt;

&lt;p&gt;TightVNC working again on my server:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F32yk5vn4crteddn1jdv8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F32yk5vn4crteddn1jdv8.png" alt="TightVnC connection made again after fixing authentication error with too many authentication failures" width="800" height="434"&gt;&lt;/a&gt;&lt;br&gt;
Further, read on how to prevent this from happening again can be found here by &lt;a href="https://solveoptimized.com/how-to-resolve-prevent-too-many-authentication-failures-with-vnc/" rel="noopener noreferrer"&gt;solveopti&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You can help improve this article on github (File is named same as the title of the article)&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/Juni4567" rel="noopener noreferrer"&gt;
        Juni4567
      &lt;/a&gt; / &lt;a href="https://github.com/Juni4567/dev.to"&gt;
        dev.to
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      This is a repository of my articles posted on dev.to. You can contribute to these articles by submitting a PR
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;div class="markdown-heading"&gt;
&lt;h1 class="heading-element"&gt;dev.to&lt;/h1&gt;

&lt;/div&gt;

&lt;p&gt;This is a repository of my articles posted on dev.to. You can contribute to these articles by submitting a PR&lt;/p&gt;

&lt;/div&gt;
&lt;br&gt;
&lt;br&gt;
  &lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/Juni4567/dev.to"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;


</description>
      <category>vncserver</category>
      <category>tightvnc</category>
      <category>rdp</category>
      <category>ubuntu</category>
    </item>
    <item>
      <title>How to set up SSH access with RSA private key on Windows - GitBash</title>
      <dc:creator>Junaid Anwar</dc:creator>
      <pubDate>Sun, 29 Jul 2018 12:38:34 +0000</pubDate>
      <link>https://dev.to/juni/how-to-set-up-ssh-access-with-rsa-private-key-on-windows---gitbash-2hio</link>
      <guid>https://dev.to/juni/how-to-set-up-ssh-access-with-rsa-private-key-on-windows---gitbash-2hio</guid>
      <description>&lt;p&gt;SSH access from windows does not require any extra software to be installed on your computer. It can be accessed right from your favourite command line tool. Today I'll show you how to easily access your cloud servers via SSH by using your favourite command line tool and save it for you to access it later on as well.&lt;/p&gt;

&lt;p&gt;Install GitBash in your computer and then run the following command.&lt;/p&gt;

&lt;pre&gt;
$ cd ~/.ssh
// If the above commands returns: 
bash: cd: /c/Users/junaid/.ssh: No such file or directory 
// Then run the following commands instead

$ mkdir ~/.ssh
$ cd ~/.ssh
$ explorer .
&lt;/pre&gt;

&lt;blockquote&gt;
I am using GitBash because I love it. You can also use the windows command line tool if you prefer (there is a slight difference)
&lt;/blockquote&gt;

&lt;p&gt;On windows command prompt you can just open windows command prompt from the start menu and run the following commands:&lt;/p&gt;

&lt;pre&gt;cd .ssh
// If the above command returns: 
The system cannot find the path specified.
// Then run the following commands instead

mkdir .ssh
explorer .
&lt;/pre&gt;

&lt;p&gt;It will open the folder for you. Paste your "Private RSA Key" file in this folder and create a config file("config" no file type extension needed ). If you already have a config file then edit it and copy the following code into it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4ytinieq16ih5nk3a6h2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4ytinieq16ih5nk3a6h2.png" alt="Alt Text" width="800" height="483"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;pre&gt;Host X
    HostName xxx.xxx.xxx.xxx
    User root
    IdentityFile ~/.ssh/fileNameWhereRSAKeyIsStored
    IdentitiesOnly yes
    Port ****
    ServerAliveInterval 60&lt;/pre&gt;

&lt;p&gt;Edit the details in the config file and put the HostName, user and port number that you got from the SSH service provider.&lt;/p&gt;

&lt;h3&gt;
  
  
  Naming your RSA files
&lt;/h3&gt;

&lt;p&gt;For your RSA file you can name it whatever you like (no file name extension needed). The file will be referenced in your config file as &lt;code&gt;IdentityFile&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now, whenever you need to connect to the SSH just run the following command.&lt;/p&gt;

&lt;pre&gt;$ ssh X&lt;/pre&gt;

&lt;p&gt;You can also configure more than on SSH hosts if you like. All you have to do is paste your RSA key file and edit the config file. For example, If I have to configure two SSH hosts then my config file would look like this:&lt;/p&gt;

&lt;pre&gt;Host X
    HostName xxx.xxx.xxx.xxx
    User root
    IdentityFile ~/.ssh/fileNameWhereRSAKeyIsStored
    IdentitiesOnly yes
    Port portNumberOfSSH
    ServerAliveInterval 60

Host Y
    HostName yyy.yyy.yyy.yyy
    User root
    IdentityFile ~/.ssh/fileNameWhereRSAKeyIsStored
    IdentitiesOnly yes
    Port portNumberOfSSH
    ServerAliveInterval 60&lt;/pre&gt;

&lt;p&gt;Easy no?&lt;/p&gt;

</description>
      <category>ssh</category>
      <category>windows</category>
      <category>gitbash</category>
      <category>cmdprompt</category>
    </item>
    <item>
      <title>Git and Github - must know commands to make your first commit</title>
      <dc:creator>Junaid Anwar</dc:creator>
      <pubDate>Sun, 15 Jul 2018 15:47:45 +0000</pubDate>
      <link>https://dev.to/juni/git-and-github---must-know-commands-to-make-your-first-commit-333c</link>
      <guid>https://dev.to/juni/git-and-github---must-know-commands-to-make-your-first-commit-333c</guid>
      <description>&lt;p&gt;You want to learn github and how to contribute to the open source? You don't know how to use github with all its powers?&lt;/p&gt;

&lt;p&gt;The Git environment is a vast and sometimes gets very complicated when you have to work on bigger projects. These days almost every software company use github as their first version controlling system. &lt;/p&gt;

&lt;p&gt;By understanding these must know commands you will become an even better web developer.&lt;/p&gt;

&lt;p&gt;I assume that you have already cloned your repository and are ready to just make your changes and push. So let's get started.&lt;/p&gt;

&lt;h3&gt;
  
  
  [git status]
&lt;/h3&gt;

&lt;p&gt;Check if there are already some changes tracked in the repository by git? &lt;code&gt;git status&lt;/code&gt; will list any files that are changed.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj9cr90y8801bklkfzjf9.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj9cr90y8801bklkfzjf9.gif" alt="Gif where Git status is typed in and the output is shown once without changing any file and another time with changed file" width="800" height="448"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  [git add .]
&lt;/h3&gt;

&lt;p&gt;This is the first command that you'll run after making some changes to the project files. &lt;/p&gt;

&lt;p&gt;The command analyzes all the repository files and adds all modified and new (untracked) files in the current directory and all subdirectories to the staging area (a.k.a. the index), thus preparing them to be included in the next &lt;code&gt;git commit&lt;/code&gt; which I'll explain in the next lines. Any files matching the patterns in the .gitignore file will be ignored by &lt;code&gt;git add .&lt;/code&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F874cos9z64e5g198bm8y.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F874cos9z64e5g198bm8y.gif" alt="gif showing how to run git add . in command line" width="1372" height="922"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  [git commit -am "your commit message"]
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;git commit -am&lt;/code&gt; adds the changed files into a commit with a commit message as stated inside the inverted commas(in the hading). Using the option -am allows you to add and create a message for the commit in one command.&lt;/p&gt;



&lt;br&gt;
The &lt;code&gt;-a&lt;/code&gt; flag is used in git to add all the files to your commit and then you'll have to run another command where you write your commit message. 

&lt;p&gt;The &lt;code&gt;m&lt;/code&gt; flag is used for connecting a commit message to your commit for example `git commit -m "your message". &lt;br&gt;
&lt;/p&gt;


&lt;p&gt;Be very careful when using this command because it will add all the changed files to your commit which you may not want in many cases. You can add individual files to the stging area by using &lt;code&gt;git add&lt;/code&gt;. For example &lt;code&gt;git add file1.js image.png index.php&lt;/code&gt; to add only "file1.js", "image.png" and "index.php" to the staging area and then you can create a commit with &lt;code&gt;git commit -m "your commit message"&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Hence &lt;code&gt;git commit -am "your commit message"&lt;/code&gt; is the second command that you must know.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F32s5ul1v6ctasyo4c7m6.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F32s5ul1v6ctasyo4c7m6.gif" alt="gif showing how to make your first commit with the commit message from the command line" width="1372" height="922"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  [git push origin master]
&lt;/h3&gt;

&lt;p&gt;You are ready to push your first commit to the remote repository. The &lt;code&gt;push&lt;/code&gt; here is for pushing your changes which requires a branch to push to call it &lt;code&gt;origin&lt;/code&gt; and then specify the branch name &lt;code&gt;master&lt;/code&gt; (the default branch that always exists on any repository.&lt;/p&gt;

&lt;p&gt;So &lt;code&gt;git push origin master&lt;/code&gt; will take the local commit that you made in the above sections and upload it to the remote server on github for other people to collaborate.&lt;/p&gt;

&lt;p&gt;What's next?&lt;br&gt;
Now that you know how to make your first commit and push it to the remote repository here are some other commands that you should know to start working on a team project.&lt;/p&gt;

&lt;h3&gt;
  
  
  [git pull]
&lt;/h3&gt;

&lt;p&gt;Suppose you are now another dev working on the same repository so you'll have to use this command to pull in the changes that you just pushed to the repository before making any commits. If you don't pull then GitHub will yell at you that you need to pull first.&lt;/p&gt;

&lt;h3&gt;
  
  
  [git checkout -b "new-branch"]
&lt;/h3&gt;

&lt;p&gt;You'll need this command too often while collaborating on a project that has more than one devs working on it. It creates a new branch for you with the name of the branch stated in the inverted commas (another gotcha here is the hyphen separated name for the branch which is necessary).&lt;/p&gt;

&lt;p&gt;You can see in gifs above that there is (master) written after the name of the folder where you are running the command. That (master) is the default branch that gets created in every repository. If you see (master) in your command line then the `git checkout -b "new-branch" will create a new branch based from the master branch. In other words, the branch you check out to will be based on the branch name you see in the command line so be careful about that.&lt;/p&gt;

&lt;p&gt;Once you have checked out to a branch you'll be able to work in a detached environment having all the files from master. This way if you mess something you just go back to master branch and you'll have the initial files back. Many professional devs like to work like that.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final notes
&lt;/h2&gt;

&lt;p&gt;Here is a gist of what we have learnt so far:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;th&gt;Git task&lt;/th&gt;
            &lt;th&gt;Notes&lt;/th&gt;
            &lt;th&gt;Git commands&lt;/th&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td&gt;&lt;strong&gt;Status &lt;/strong&gt;&lt;/td&gt;
            &lt;td&gt;List the files you've changed and those you still need to add or commit:&lt;/td&gt;
            &lt;td&gt;&lt;code&gt;git status&lt;/code&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td&gt;&lt;strong&gt;Add files &lt;/strong&gt;&lt;/td&gt;
            &lt;td&gt;Add one or more files to staging (index):&lt;/td&gt;
            &lt;td&gt;
&lt;code&gt;git add &amp;lt;filename&amp;gt;&lt;/code&gt;&lt;br&gt;
            &lt;code&gt;git add .&lt;/code&gt;
&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td&gt;&lt;strong&gt;Commit &lt;/strong&gt;&lt;/td&gt;
            &lt;td&gt;Commit changes to head (but not yet to the remote repository):&lt;/td&gt;
            &lt;td&gt;&lt;code&gt;git commit -m "Commit message"&lt;/code&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td&gt;&lt;/td&gt;
            &lt;td&gt;Commit any files you've added with &lt;code&gt;git add&lt;/code&gt;, and also commit any files you've changed since then:&lt;/td&gt;
            &lt;td&gt;&lt;code&gt;git commit -a&lt;/code&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td&gt;&lt;strong&gt;Push &lt;/strong&gt;&lt;/td&gt;
            &lt;td&gt;Send changes to the master branch of your remote repository:&lt;/td&gt;
            &lt;td&gt;&lt;code&gt;git push origin master&lt;/code&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td&gt;&lt;strong&gt;Update from the remote repository&lt;/strong&gt;&lt;/td&gt;
            &lt;td&gt;Fetch and merge changes on the remote server to your working directory:&lt;/td&gt;
            &lt;td&gt;&lt;code&gt;git pull&lt;/code&gt;&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td&gt;&lt;strong&gt;Branches &lt;/strong&gt;&lt;/td&gt;
            &lt;td&gt;Create a new branch and switch to it:&lt;/td&gt;
            &lt;td&gt;&lt;code&gt;git checkout -b &amp;lt;branchname&amp;gt;&lt;/code&gt;&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;To become a better software developer you need to learn these workflows because they not only boost your productivity but also adds confidence to your way of working that if you break something it can be reverted. &lt;/p&gt;

&lt;h2&gt;
  
  
  And finally some tips
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Don’t EVER commit private keys / api keys/certificates.&lt;/li&gt;
&lt;li&gt;Integrate linters and code checkers and beautifiers such as jsPrettier (but first ask your team first if they use any)&lt;/li&gt;
&lt;li&gt;Use descriptive commit messages and branch names.&lt;/li&gt;
&lt;li&gt;Create a branch for every new feature, and delete the branch once the feature is merged into main.&lt;/li&gt;
&lt;li&gt;Tag your commit messages with the ticket number it corresponds with (if you are working in an agile environment)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://www.atlassian.com/git/tutorials/what-is-git" rel="noopener noreferrer"&gt;Read more about some advanced git commands on atlassian &lt;/a&gt;&lt;/p&gt;

</description>
      <category>github</category>
      <category>git</category>
      <category>gitnewbie</category>
      <category>tips</category>
    </item>
  </channel>
</rss>
