One place for hosting & domains

      Request

      How to Fix: 400 Bad Request Error


      As you’re browsing the web, you may stumble across an invalid page. Sometimes, a site’s server won’t be able to understand your request for its content. Instead of the requested resources, you’ll see a “400 Bad Request” error message.

      Fortunately, the 400 Bad Request issue is easy to resolve. Often, fixing typos in the URL will do the trick, but you may also need to clear your browser cache or temporarily disable extensions.

      In this post, we’ll explain what the 400 Bad Request error is and what causes it. Then, we’ll look at six different ways to fix it. Let’s get started!

      An Introduction to the 400 Bad Request Error

      When you try to access a web page, your browser requests the site’s data from its server. The web server will then process the request. Within the HTTP header, there will be a status code explaining whether the request was successful or not.

      In a successful HTTP request, you won’t see the status code. However, sometimes your web browser may display an error message like “400 Bad Request”:

      400 Bad Request error

      This 400-level HTTP status code indicates that there was a client-side error in the request. As a result, you won’t be able to view the page you requested.

      While this error typically shows up as “400 Bad Request”, you may see some variations:

      • Bad Request – Invalid URL
      • HTTP Error 400
      • HTTP Error 400 – Bad Request
      • HTTP Status 400 – Bad Request
      • 400 – Bad Request. The request could not be understood by the server due to malformed syntax. The client should not repeat the request without modifications.
      • Bad Request. Your browser sent a request that this server could not understand.
      • 400 Bad Request. Request Header Or Cookie Too Large
      • Bad Request – Error 400

      The 400 Bad Request error can be very frustrating, as it blocks access to the site without giving you any helpful information. Let’s discuss some of the most common causes.

      Potential Causes for the 400 Bad Request Error

      When a server returns a 400 Bad Request, it means that it cannot understand and process your request. Usually, this is due to a client-side error, which means there’s a problem on your end.

      Here are some common issues that may cause a 400 Bad Request error:

      • Invalid URL syntax: You may have mistyped the URL or used invalid characters.
      • Corrupted browser cache or cookies: If your browser cookies have expired or your cache is corrupted, the server may not be able to process your request properly.
      • Conflicting browser extensions: In some cases, your browser extensions can interfere with the request and cause a 400 Bad Request.
      • Bad DNS cache: Your locally cached DNS data could be out of sync with the current DNS registration for the domain.
      • Large uploaded file size: If you’re uploading a large file to a site, it could exceed the maximum upload limit.

      Alternatively, a 400 HTTP error could appear due to a server-side error. For example, the website may have a misconfigured server or a temporary glitch.

      How to Fix the 400 Bad Request Error (6 Methods)

      When you see a 400 Bad Request error, you can try refreshing the page. In some cases, this will resolve any temporary glitches. If it doesn’t work, you can try the following steps.

      1. Check for Errors in the Address

      First, you’ll want to check your URL for any errors. This is one of the most common causes of a 400 Bad Request.

      There could be typos, malformed syntax, or extra characters in the address. It’s important to go back to the domain name, directory path, and query string to make sure the address is correct.

      During this process, check for special symbols. For example, random characters like hyphens (-) or percentages (%) could cause the Bad Request:

      Invalid URL

      Some URLs have special characters, but you’ll need to make sure they’ve been coded correctly. You can check the address using a URL Decoder/Encoder. This tool will identify any invalid characters in the URL:

      URL decoder

      Then, try searching for the URL again. If the same 400 error pops up, you can also try searching for the web page in a different way.

      For example, you can run a search for the site’s domain name and a relevant keyword. If you were looking for our post on featured image sizes, you would type ‘site: dreamhost.com featured image sizes’ into a search engine:

      Search for page keyword

      This will enable you to access the page without having to type the URL manually. However, you may still get a 400 Bad Request error. If this happens, continue to the following method.

      2. Clear Your Browser’s Cache and Cookies

      Your browser saves site data in a cache. This way, when you revisit that site in the future, the browser will serve the cached content to make the page load faster.

      As you’re browsing the Internet, cookies will also be stored in your browser. These are small files that contain data such as the length of your browsing session. Cookies can also remember personalized information like your login details or site preferences.

      Although your browser’s cache and cookies can be helpful tools, they can also become corrupted. Additionally, cookies can eventually expire. When this happens, it can trigger a 400 Bad Request.

      To solve this problem, consider clearing the cache and cookies in your browser. In Google Chrome, you’ll need to hit the three-dot icon in the upper right-hand corner. Then, select More Tools > Clear Browsing Data:

      Clear Chrome browsing data

      This will open a pop-up window where you can choose the data you want to clear. Make sure to select Cookies and other site data as well as Cached images and files:

      Clear cookies and cache

      If the Bad Request error happens on a different device or browser type, this process will look a little different. If you use an iPhone or Microsoft computer, you’ll have to review the company’s knowledge base for clearing your specific cache, cookies, or browsing data.

      Keep in mind that this will sign you out of many websites. You may also experience slower loading times when you visit these sites again. However, it could remove corrupted or expired data that may cause a 400 Bad Request.

      3. Disable Browser Extensions

      If you’re a website owner, you likely know that third-party plugins can cause many WordPress errors. Similarly, the software in your browser extensions could interfere with your request.

      To get started, try disabling your extensions. If you’re using Google Chrome, click on the three dots again and navigate to More Tools > Extensions:

      Disable Chrome extensions

      This will take you to a page where you can manage your Chrome extensions. Using the toggle switches, turn all of them off:

      Chrome extensions

      Now, reload the page that triggered a Bad Request. If it loads successfully, then one of these extensions caused the error.

      To find the problematic extension, reactivate them one by one, each time checking to see if the error has returned. Once it does, remove the extension that caused it. This should prevent any 400 HTTP status codes in the future.

      4. Flush the DNS Cache

      The first time you visit a website, some of its data is stored locally in a cache. To load pages faster, your computer will save DNS information about websites. This will eliminate the need to search for the site’s nameserver and IP address every time you come back.

      Just like your browser cache, the DNS cache can also become corrupt or outdated. Sometimes, a website will update its DNS information. If this conflicts with your cached data, it can lead to a 400 Bad Request error.

      To fix this error, you’ll need to flush your DNS cache. For macOS operating systems running on Monterey and Big Sur, open the Terminal and enter this command:

      sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder

      If you have Windows 10, open the Command Prompt and type in the following command:

      ipconfig /flushdns

      With Linux operating systems, you’ll use Terminal as your command line. To flush the DNS, simply execute this command:

      sudo systemd-resolve --flush-caches

      You may also need to flush the DNS cache for your browser. To do this in Google Chrome, paste the following line into your search bar:

      chrome://net-internals/#dns

      Then, click on Clear host cache. This will flush your browser’s DNS cache:

      Clear browser DNS

      After you successfully flush your DNS, check to see if this resolved the error. If not, you’ll need to try another method.

      5. Check the Uploaded File Size

      Sometimes, you’ll see the 400 Bad Request error right after uploading a file to a website. In this case, your file may be too big to upload to the site’s server.

      Every site has a maximum file upload size. Although this is set by the hosting provider, it usually falls between 2 and 500 MB. If you upload a larger file, you’ll likely receive a Bad Request.

      To see if this is the case, start by uploading a smaller file. If this is successful, you’ll need to resize or compress the original file.

      You can use a tool like TinyPNG to reduce file sizes:

      TinyPNG website

      If allowed by the site, you can also try uploading a zip file. Ultimately, you’ll want to reduce file sizes enough to stay within the server’s file size upload limit.

      6. Troubleshoot Your Device and Internet Connection

      When every single page you visit returns a 400 Bad Request, you might have a poor Internet connection. To see if this is the case, try switching to a different network. For example, you can turn off Wi-Fi for your mobile device and use cellular data.

      If this resolves the error, you can troubleshoot your Internet connection. You may need to restart your Wi-Fi router. Alternatively, consider contacting your service provider to fix the issue.

      You can also try turning your device off and back on again. Since this can clear Random Access Memory (RAM), flush temporary caches, and close running programs, it may help solve a Bad Request.

      Error-Free Browsing

      The 400 Bad Request error is a client-side HTTP status code that crops up when a server is unable to fulfill a request. This is usually caused by typos in the URL, corrupt browser cookies, or conflicting browser extensions.

      Fortunately, there are many ways to resolve the issue. One simple solution is to reload the browser and check for temporary glitches. However, you may need to flush your DNS cache, restart your device, or reduce uploaded file sizes.

      For more error troubleshooting tips, subscribe to the DreamHost blog! We’ll update you every time we post new content.

      Get Content Delivered Straight to Your Inbox

      Subscribe to our blog and receive great content just like this delivered straight to your inbox.



      Source link

      Processing Incoming Request Data in Flask


      In any web app, you’ll have to process incoming request data from users. Flask, like any other web framework, allows you to access the request data easily.

      In this tutorial, we’ll go through how to process incoming data for the most common use cases. The forms of incoming data we’ll cover are: query strings, form data, and JSON objects. To demonstrate these cases, we’ll build a simple example app with three routes that accept either query string data, form data, or JSON data.

      The Request Object

      To access the incoming data in Flask, you have to use the request object. The request object holds all incoming data from the request, which includes the mimetype, referrer, IP address, raw data, HTTP method, and headers, among other things. Although all the information the request object holds can be useful, in this article, we’ll only focus on the data that is normally directly supplied by the caller of our endpoint.

      To gain access to the request object in Flask, you simply import it from the Flask library.

      from flask import request
      

      You then have the ability to use it in any of your view functions.

      Once we get to the section on query strings, you’ll get to see the request object in action.

      The Example App

      To demonstrate the different ways of using request, we’ll start with a simple Flask app. Even though the example app uses a simple organization layout for the view functions and routes, what you learn in this tutorial can be applied to any method of organizing your views like class-based views, blueprints, or an extension like Flask-Via.

      To get started, first we need to install Flask.

      pip install Flask
      

      Then, we can start with the following code.

      #app.py
      
      from flask import Flask, request #import main Flask class and request object
      
      app = Flask(__name__) #create the Flask app
      
      @app.route('/query-example')
      def query_example():
          return 'Todo...'
      
      @app.route('/form-example')
      def formexample():
          return 'Todo...'
      
      @app.route('/json-example')
      def jsonexample():
          return 'Todo...'
      
      if _name == '__main_':
          app.run(debug=True, port=5000) #run app in debug mode on port 5000
      

      Start the app with:

      python app.py
      

      The code supplied sets up three routes with a message telling us ‘Todo…’. The app will start on port 5000, so you can view each route in your browser with the following links:

      http://127.0.0.1:5000/query-example (or localhost:5000/query-example)
      http://127.0.0.1:5000/form-example (or localhost:5000/form-example)
      http://127.0.0.1:5000/json-example (or localhost:5000/json-example)

      For each of the three routes, you’ll see the same thing:

      Query Arguments

      URL arguments that you add to a query string are the simpliest way to pass data to a web app, so let’s start with them.

      A query string looks like the following:

      example.com?arg1=value1&arg2=value2
      

      The query string begins after the question mark (?) and has two key-value pairs separated by an ampersand (&). For each pair, the key is followed by an equals sign (=) and then the value. Even if you’ve never heard of a query string until now, you have definitely seen them all over the web.

      So in that example, the app receives:

      arg1 : value1
      arg2 : value2
      

      Query strings are useful for passing data that doesn’t require the user to take action. You could generate a query string somewhere in your app and append it a URL so when a user makes a request, the data is automatically passed for them. A query string can also be generated by forms that have GET as the method.

      To create our own query string on the query-example route, we’ll start with this simple one:

      http://127.0.0.1:5000/query-example?language=Python

      If you run the app and navigate to that URL, you’ll see that nothing has changed. That’s only because we haven’t handled the query arguments yet.

      To do so, we’ll need to read in the language key by using either request.args.get('language') or request.args['language'].

      By calling request.args.get('language'), our application will continue to run if the language key doesn’t exist in the URL. In that case, the result of the method will be None. If we use request.args['language'], the app will return a 400 error if language key doesn’t exist in the URL. For query strings, I recommend using request.args.get() because of how easy it is for the user to modify the URL. If they remove one of the keys, request.args.get() will prevent the app from failing.

      Let’s read the language key and display it as output. Modify with query-example route the following code.

      @app.route('/query-example')
      def query_example():
          language = request.args.get('language') #if key doesn't exist, returns None
      
          return '''<h1>The language value is: {}</h1>'''.format(language)
      

      Then run the app and navigate to the URL.

      As you can see, the argument from the URL gets assigned to the language variable and then gets returned to the browser. In a real app, you’d probably want to do something with the data other than simply return it.

      To add more query string parameters, we just append ampersands and the new key-value pairs to the end of the URL. So an additional pair would look like this:

      http://127.0.0.1:5000/query-example?language=Python&framework=Flask

      With the new pair being:

      framework : Flask
      

      And if you want more, continue adding ampersands and key-value pairs. Here’s an example:

      http://127.0.0.1:5000/query-example?language=Python&framework=Flask&website=Scotch

      To gain access to those values, we still use either request.args.get() or request.args[]. Let’s use both to demonstrate what happens when there’s a missing key. We’ll assign the value of the results to variables and then display them.

      @app.route('/query-example')
      def query_example():
          language = request.args.get('language') #if key doesn't exist, returns None
          framework = request.args['framework'] #if key doesn't exist, returns a 400, bad request error
          website = request.args.get('website')
      
          return '''<h1>The language value is: {}</h1>
                    <h1>The framework value is: {}</h1>
                    <h1>The website value is: {}'''.format(language, framework, website)
      

      When you run that, you should see:

      If you remove the language from the URL, then you’ll see that the value ends up as None.

      If you remove the framework key, you get an error.

      Now that you undertand query strings, let’s move on to the next type of incoming data.

      Form Data

      Next we have form data. Form data comes from a form that has been sent as a POST request to a route. So instead of seeing the data in the URL (except for cases when the form is submitted with a GET request), the form data will be passed to the app behind the scenes. Even though you can’t easily see the form data that gets passed, your app can still read it.

      To demonstrate this, modify the form-example route to accept both GET and POST requests and to return a simple form.

      @app.route('/form-example', methods=['GET', 'POST']) #allow both GET and POST requests
      def form_example():
          return '''<form method="POST">
                        Language: <input type="text" name="language"><br>
                        Framework: <input type="text" name="framework"><br>
                        <input type="submit" value="Submit"><br>
                    </form>'''
      

      Running the app results in this:

      The most important thing to know about this form is that it performs a POST request to the same route that generated the form. The keys that we’ll read in our app all come from the “name” attributes on our form inputs. In our case, language and framework are the names of the inputs, so we’ll have access to those in our app.

      Inside the view function, we need to check if the request method is GET or POST. If it’s GET, we simply display the form we have. If it’s POST, then we want to process the incoming data.

      To do that, let’s add a simple if statement that checks for a POST request. If the request method isn’t POST, then we know it’s GET, because our route only allows those two types of requests. For GET requests, the form will be generated.

      @app.route('/form-example', methods=['GET', 'POST']) #allow both GET and POST requests
      def form_example():
          if request.method == 'POST': #this block is only entered when the form is submitted
              return 'Submitted form.'
      
          return '''<form method="POST">
                        Language: <input type="text" name="language"><br>
                        Framework: <input type="text" name="framework"><br>
                        <input type="submit" value="Submit"><br>
                    </form>'''
      

      Inside of the block, we’ll read the incoming values with request.args.get('language') and request.form['framework']. Remember that if we have more inputs, then we can read additional data.

      Add the additional code to the form-example route.

      @app.route('/form-example', methods=['GET', 'POST']) #allow both GET and POST requests
      def form_example():
          if request.method == 'POST':  #this block is only entered when the form is submitted
              language = request.form.get('language')
              framework = request.form['framework']
      
              return '''<h1>The language value is: {}</h1>
                        <h1>The framework value is: {}</h1>'''.format(language, framework)
      
          return '''<form method="POST">
                        Language: <input type="text" name="language"><br>
                        Framework: <input type="text" name="framework"><br>
                        <input type="submit" value="Submit"><br>
                    </form>'''
      

      Try running the app and submitting the form.

      Similiar to the query string example before, we can use request.form.get() instead of referencing the key directly with request.form[]. request.form.get() returns None instead of causing a 400 error when the key isn’t found.

      As you can see, handling submitted form data is just as easy as handling query string arguments.

      JSON Data

      Finally, we have JSON data. Like form data, it’s not so easy to see. JSON data is normally constructed by a process that calls our route. An example JSON object looks like this:

      {
          "language" : "Python",
          "framework" : "Flask",
          "website" : "Scotch",
          "version_info" : {
              "python" : 3.4,
              "flask" : 0.12
          },
          "examples" : ["query", "form", "json"],
          "boolean_test" : true
      }
      

      As you can see with JSON, you can pass much more complicated data that you could with query strings or form data. In the example, you see nested JSON objects and an array of items. With Flask, reading all of these values is straightforward.

      First, to send a JSON object, we’ll need a program capable of sending custom requests to URLs. For this, we can use an app called Postman.

      Before we use Postman though, change the method on the route to accept only POST requests.

      @app.route('/json-example', methods=['POST']) #GET requests will be blocked
      def json_example():
          return 'Todo...'
      

      Then in Postman, let’s do a little set up to enable sending POST requests.

      In Postman, add the URL and change the type to POST. On the body tab, change to raw and select JSON (application/json) from the drop down. All this is done so Postman can send JSON data properly and so your Flask app will understand that it’s receiving JSON.

      From there, you can copy the example into the text input. It should look like this:

      To test, just send the request and you should get ‘Todo…’ as the response because we haven’t modified our function yet.

      To read the data, first you must understand how Flask translates JSON data into Python data structures.

      Anything that is an object gets converted to a Python dict. {"key" : "value"} in JSON corresponds to somedict['key'], which returns a value in Python.

      An array in JSON gets converted to a list in Python. Since the syntax is the same, here’s an example list: [1,2,3,4,5]

      Then the values inside of quotes in the JSON object become strings in Python. true and false become True and False in Python. Finally, numbers without quotes around them become numbers in Python.

      Now let’s get on to reading the incoming JSON data.

      First, let’s assign everything from the JSON object into a variable using request.get_json().

      req_data = request.get_json()
      

      request.get_json() converts the JSON object into Python data for us. Let’s assign the incoming request data to variables and return them by making the following changes to our json-example route.

      @app.route('/json-example', methods=['POST']) #GET requests will be blocked
      def json_example():
          req_data = request.get_json()
      
          language = req_data['language']
          framework = req_data['framework']
          python_version = req_data['version_info']['python'] #two keys are needed because of the nested object
          example = req_data['examples'][0] #an index is needed because of the array
          boolean_test = req_data['boolean_test']
      
          return '''
                 The language value is: {}
                 The framework value is: {}
                 The Python version is: {}
                 The item at index 0 in the example list is: {}
                 The boolean value is: {}'''.format(language, framework, python_version, example, boolean_test)
      

      If we run our app and submit the same request using Postman, we will get this:

      Note how you access elements that aren’t at the top level. ['version']['python'] is used because you are entering a nested object. And ['examples'][0] is used to access the 0th index in the examples array.

      If the JSON object sent with the request doesn’t have a key that is accessed in your view function, then the request will fail. If you don’t want it to fail when a key doesn’t exist, you’ll have to check if the key exists before trying to access it. Here’s an example:

      language = None
      if 'language' in req_data:
          language = req_data['language']
      

      Conclusion

      You should now understand how to use the request object in Flask to get the most common forms of input data. To recap, we covered:

      • Query Strings
      • Form Data
      • JSON Data

      With this knowledge, you’ll have no problem with any data that users throw at your app!

      Learn More

      If you like this tutorial and want to learn more about Flask from me, check out my free Intro to Flask video course at my site Pretty Printed, which takes you from knowing nothing about Flask to building a guestbook app. If that course isn’t at your level, then I have other courses on my site that may interest you as well.



      Source link

      Hacktoberfest: How to Submit Your First Pull Request on Github


      Introduction

      Hacktoberfest is a month-long celebration of open source software, run by DigitalOcean and open to everyone in our global community. To participate, you’ll need to submit four quality pull requests to public GitHub repositories in the month of October. Upon completing the challenge, you’ll earn special prizes, including an exclusive Hacktoberfest t-shirt.

      You can sign up anytime between October 1 and October 31, and we encourage you to connect with other developers and Hacktoberfest enthusiasts for virtual events and information sessions, starting in September.

      In this tutorial we’ll introduce you to Git, the version control system that you’ll use to submit your pull request, and Github, the repository hosting service that we’ll be using to track your progress. By the end of this tutorial, you’ll be ready to submit your first pull request and will be well on your way to participating in Hacktoberfest!

      Version Control

      Before we begin with Git and Github, let’s talk about version control. When developers work on a project together, oftentimes they’ll need to work on the same code base. While they’re working, each developer needs to know about what changes the other developer made, so as not to duplicate work or write code over what has already been done.

      A version control system serves as a saving program for code, where it assigns a version to a project and tracks changes made over time to each file in the project. In this way, developers can work together on a project by checking in with the latest version, to see the changes made before working on their portion of the project’s code.

      Git and Github

      Git, a version control system used to manage developer projects of all sizes, was created in 2005 by Linus Torvalds, the creator of Linux, to help developers contribute code and share code revisions in a way that was fast, efficient, and inexpensive. Git enables developers to edit, share, and publish code, facilitating collaboration and teamwork.

      Github is a cloud-based git repository hosting service that allows developers to take code that they’ve written on their local machines and share it with the world. It provides a way to share the version-tracked projects on your local computer publicly through repositories, or central file storage locations, and depending on the project’s availability (it can be either a public or private repository), other developers can download the project to edit the code, provide insight, and more.

      To get started with Github, you can create an account at Github. For more details on how to do that, please refer to the Hacktoberfest resources page.

      Cloning a Repository

      We’ll now clone and edit our first Github repository. First, let’s navigate to the repository that we’d like to clone. For the sake of this tutorial, we’ll use the Cloud Haiku repository.
      Before you clone this repository, that is, take a copy of the code on Github onto your local machine, you’ll need to take a copy of the whole repository into your own Github account. This is called a fork of the repository, and it allows you to develop your code without affecting the main code base.

      To fork a repository, click the Fork button at the top right in the repository. To clone, click the code button, take a copy of the link provided, then watch as Github takes this repository and adds it as a copy to your account. Your name should now appear as the creator of this repository, which is a ‘fork’ of the main haiku repository.

      Clone the repository

      Next, navigate to your command line interface to clone the project on your local machine.You can do that with the git clone command, which will clone, or copy, the fork that I just created from the haiku repository down to my local machine. This will enable you to make changes to the codebase locally (on your own machine).

      • cd ~
      • git clone https://github.com/sammy/cloud_haiku

      Editing Code Content

      You now have a copy of the Cloud Haiku repository on your local machine, so you’re ready to prepare your contribution. Using the command line interface, navigate to the folder of your cloned repository. If you followed along, you should have a cloud_haiku folder inside your home directory:

      There’s a number of text editors and Integrated Development Environments (IDEs) that you can use to edit your code. IDEs are typically segmented by programming language and include a series of helpful features to streamline the process of developing an application in that language. If you don’t have an IDE currently set up within your work machine, consider checking out Hacktoberfest’s resources page for advice on how to choose an IDE.

      It’s important to take the time to read and understand how the project is organized and the contribution guidelines, and find parts of the code that you can work on. Read any associated documentation provided before making changes. Next, let’s submit a haiku!

      Browse the Codebase

      Adding Content to the Remote Repository

      Now that we have a change made to the haiku repository, we’ll need to track and save that change. The first step in tracking your change is to add it to the version you’re working on. To do that, we’ll execute the command git add . :

      Writing the command in this way allows you to add all changes made to the repository, across files. If you need to only submit changes to an individual file, use git add filename:

      After running the add command, you’ll get no confirmation. To see if your changes have been included in the list of files that is ready to be committed, you can execute the command git status:

      This allows you to check on the status of your tracked changes — you’ll see that your file has been added, but not committed as a change. Git provides this step in the event that you need to amend a change before officially tracking it as new or edited code.

      Git Add

      Next, let’s commit our change. Execute the command git commit, and add a message so that other developers who are collaborating on this project will know about the changes you’ve made:

      • git commit -m "added sammy haiku"

      Writing your commit with a message allows developers to be informed of changes that are made — this message is tracked along with a commit ID and your username.

      Git Commit

      After committing, we’ll need to push changes from our local machine to the remote repository on Github. To do this, let’s execute the command git push:

      Here, we can designate an origin for the push — in this instance, we want our contributions to go to our forked version of DigitalOcean’s haiku repository.

      Git Push

      To recap, so far we’ve identified a repository that we’d like to edit, and took a copy of the repository into our Github account and local machine using fork and clone. We made a change, and submitted our change with git add. We then solidified our change by running git commit, which committed the change. git push pushed our change from our local machines to the remote repository on Github. If we look on Github, we’ll see that the change we made is reflected in the files in our copy of the haiku repository.

      Creating a Pull Request

      We’re now ready to let the maintainers of the project know that we have a change to the repository that we’re confident about and ready to submit. To do this, we’ll click the pull request button to the right.

      Submit a PR

      After the pull request button is clicked, a new page will open with a form that explains what change we made, and shows if the changes made will in any way conflict with the existing content. We’ll add in an appropriate title that details the change, and in the description add an explanation of what changes were made and why. What you add here can vary depending on the project – take a look at the project’s collaboration guidelines to make sure your pull request is formatted correctly.

      After adding in a title and description of the changes made, we’ll scan the pull request page to make sure that our committed change does not conflict with existing changes made to the code repository. If everything checks out, we’ll get a green submit pull request button at the bottom that escalates our request to make a change to the original haiku poem codebase, a contribution that will be live for anyone viewing that main branch. Be patient — it may take maintainers some time to review your request. Amendments and comments can be added on the pull request page, and new commits made to the same affected files will appear in the request’s history.

      Congratulations- we’ve successfully submitted our first pull request!

      In this tutorial, you learned about Git and Github, and successfully identified and submitted a change to a public repository. For Hacktoberfest, you’ll need to submit 4 meaningful pull requests, so again, find the project that resonates with you and have fun hacking!

      To see this tutorial in action, here’s a helpful video that walks you through the process of submitting your first pull request:

      Video: How to Submit Your First PR

      For more information about Hacktoberfest, visit our main page.
      To learn more about Git, visit How to Use Git: A Reference Guide.
      For additional information about Github, visit Github.



      Source link