Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

364
Views
Fixing Typo in Javascript File in Github

I am very new to Github. I am trying to fix a typo in a Javascript file. I have created a separate branch, added the file but I'm not sure exactly how to amend the typo here. This just gives me an unrelated histories error and I'm just a bit confused about how to correct this file:

 // Constants
const PORT = 8001;
const HOST = '0.0.0.0';

// App
 const app = express();
 app.get('/', (req, res) => {
 res.send('Hello, Wrld');
 });

 app.listen(PORT, HOST);
 console.log(); '''

This is what I've done so far.

to say "Hello World" instead of "Hello, World"

     git branch fix_typo
     git checkout fix_typo
     git add server.js
     cat server.js
     echo “Hello, World” > server.j
     git add server.js
     git commit --amend -m "Hello, World Fix Typo"
     git checkout master
     git merge fix_typo
     git push origin fix_typo

I also wanted to ask how would I go about changing the port on this file?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You don't need to add the file to the new branch. When you make a branch, it copies all the files from the current branch.

You shouldn't just echo "Hello, World" to the file, you need to edit the file to keep all the other lines. You can use sed for this, and you can use multiple -e options to perform multiple substitutions.

git branch fix_typo
git checkout fix_typo
sed -i -e 's/Hello, Wrld/Hello, World/' -e 's/PORT = 8001/PORT = 80/' server.js
git commit -m "Hello, World Fix Typo"
git push
git checkout master
git merge fix_typo
git push origin
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!