Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

363
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda